-
Notifications
You must be signed in to change notification settings - Fork 18
Examples? #1
Comments
Hi, I will post them ASAP. But it's basically this: Setup
Callbacks
Sending messages
|
Thank you very much! I have some of this implemented, but will incorporate the rest and let you know with any issues. I am trying to communicate with a server not using this library, so I think my main issues is that I'm not sure how to incorporate the message IDs yet. |
Yeah, you could just remove it from of the classes, should be 5 minutes work I guess. I just pushed this on GitHub so other people could easily adapt it to fit in their own project. |
Hey, NetworkMessage nm = new NetworkMessage((byte)MessageType.SYNC); I don't understand how the message ID's are supposed to be used. |
@chinmayabhat the message ID's are a byte enum. It's because in my use case I had to sent different types of messages over the same socket. So with this message ID, I know which kind of message I receive and how to process it. You can find some example code above, I unfortunately haven't had the time yet to setup a correctly working demo (yeah I know it's six months ago :( ) |
Hey, thanks for the quick reply. I am unable to understand the receiving part of the script. |
@chinmayabhat if you check the code example above, you will see that you can 'subscribe' on a message ID. This means, that whatever method you bind to it, will get called when a message gets received with that ID. This method can then parse the message. So: if I do this: All messages with message type/ID |
@DynaSpan Thanks a lot! I was able to setup a connection between Unity PC application and HoloLens UWP app. To parse the message, do I need to use Read() in NetworkMessage.cs? Or is there an other way? Because when I send a message, the callback is called, but no data is transmitted. |
Depends on what kind of values you put in the message. The message gets send as a byte array and the NetworkMessage class supports reading integers, floats, longs and bytes. You should be able to easily extend this functionality (readChar() for example). This is just a barebone framework/proof-of-concept to show how you can setup networking between Hololens and Unity. |
Thanks @DynaSpan. I'll let you know if I have any further issues. You have been very helpful. :) |
Hi,
I was just wondering whether you would be able to post a simple usage example? Perhaps some code that sends a simple message and works on all three system types.
Thanks!
The text was updated successfully, but these errors were encountered: