Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Elfinnik159 · Nov 03, 2016 at 01:02 PM · https

Unity LLAPI HTTPS webSoket ->WSS

Hello. I am developing a game for WebGL (social network). They are using HTTPS only. For the network I use LLAPI (since HLAPI does not support WebGL). When I tested it on HTTP, it worked. However, when I loaded the game and went through HTTPS, the buttons "start client" got the error: Uncaught DOMException: Failed to construct 'WebSocket': An insecure WebSocket connection may not be initiated from a page loaded over HTTPS.

   if ( GUI.Button( new Rect(10, 70, 250, 30), "start server" ) )
                         {
                                 _isStarted = true;
                                 _isServer = true;
                                 NetworkTransport.Init();
 
                                 HostTopology topology = new HostTopology(m_Config, 2);
                                 m_WebSocketHostId = NetworkTransport.AddWebsocketHost(topology, port, null);           //add 2 host one for udp another for websocket, as websocket works via tcp we can do this
                                 m_GenericHostId = NetworkTransport.AddHost(topology, port, null);
                 Debug.LogError(topology.MessagePoolSizeGrowthFactor+";"+ topology.ReceivedMessagePoolSize+";"+ topology.SentMessagePoolSize+";"+m_Config.FragmentSize+";"+m_Config.MaxCombinedReliableMessageCount+";"+m_Config.MaxCombinedReliableMessageSize+";"+m_Config.MaxSentMessageQueueSize+";"+m_Config.WebSocketReceiveBufferMaxSize);
             }
 #endif
                         if (GUI.Button(new Rect(10, 100, 250, 30), "start client"))
                         {
                                 _isStarted = true;
                                 _isServer = false;
                                 NetworkTransport.Init();
 
                                 HostTopology topology = new HostTopology(m_Config, 2);
                                 m_GenericHostId = NetworkTransport.AddHost(topology, 0); //any port for udp client, for websocket second parameter is ignored, as webgl based game can be client only
                                 byte error;
                                 m_ConnectionId = NetworkTransport.Connect(m_GenericHostId, ip, port, 0, out error);
                 Debug.LogError(error + ";");
             }

All that I have found, indicating that LLAPI can not use WSS. But HTTPS uses only WSS. Can you please tell me what to do? I do not want to change to another technology LLAPI after weeks of development

For the certificate, I use cloudflare

I do not use Unity matchmaking. The master server is written in LLAPI and is on my VDS. There is also a build (index.html).

string ip = " XXX.XXX.XXX.XX ";//VDS IP

P.S. Sorry for my English. It's not me. This google translate

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Seth-Robinson · Mar 05, 2018 at 02:46 AM

At this time wss isn't supported natively by Unity.

However - It's possible to setup a utility such as stunnel under Linux to externally add this functionality transparently.

More info: https://www.codedojo.com/?p=2167 ( How to get your Unity LLAPI/WebSocket WebGL app to run under https with AutoSSL & stunnel )

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Crossdomain.xml problem in HTTPS / SSL 0 Answers

WebException/TlsException during HTTPS Request 2 Answers

Is it possible to do ssl certificate pinning in Unity iOS 1 Answer

WWW/WWWForm, does Unity validate SSL certificates over HTTPS? 0 Answers

how do setup WebPlayer Installer on an https? Esp. Facebook. 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges