• 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 Domvel · Sep 24, 2018 at 04:19 PM · realtimesocketcommunication

Communitate with other Programs in Realtime. (socket.io / websocket?)

I wondering how to communicate between Unity and another application in realtime. I tried socket.io / websocket. But I don't found a correct working library (asset).

For example Socket.IO for Unity. This library works until events are emitted. It connects to my websocket (socket io forced to only use websocket), but after emitting an event from server to client, the client only reconnects. (loop / on every event).

Another Socket.IO Asset (on github for free) has conflicts with the unity engine scripts. (Errors like ... is defined multiple times.)


Conclusion: There is no correct working socket io / websocket library. I looking for alternatives. Any idea or hint will help. Thanks for advice.


Btw. socket.io is more a pseudo websocket library. Because in most of cases it runs on polling / ajax. You can force to use websocket by transports option to ['websocket']. But the most examples does not work. In my case a simple websocket server with socket.io does not really works. The server recognized a connection but fails on events. (without errors. the events just don't work). At all this is very disappointing. But anyway. The socket.io lib for Unity has an example with socket io forced with websocket. But there I have the loop connection problem on event emit.

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
Best Answer

Answer by Domvel · Sep 25, 2018 at 08:45 AM

I found a working Unity library (WebSocket). Also this could help (not tested). As server I tested it with node ws from npm.

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

90 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How can I receive UDP messages or similar in WebGL? 1 Answer

Communication between objects and other scripts, variables and properties 1 Answer

sendMessage from Flash to Unity 1 Answer

Motion Models, Reading external data, Frame Rate and Way Points 1 Answer

Serial Communication Running Slow 0 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges