5Mixer / mphx

A little library to let you make multiplayer games easily with Haxe. No longer maintained and better options are available.
MIT License
125 stars 15 forks source link

Support for JavaScript target #2

Closed anissen closed 8 years ago

anissen commented 8 years ago

It would be awesome if this library could support the JavaScript target. This would allow games to use this library for a unified networking solution for both native and web targets.

5Mixer commented 8 years ago

Yes, I have thought of this too. (Luxe's main target is web). Problem with client side javascript is the only real socket browsers support is websocket. Websocket has a predefined protocol that is different to the existing protocol. I'm think that maybe, somehow a websocket server can run on a different port, and websockets can connect to this. I'll think about it, I go back to school today, but this is definitely on my todo.

Also, a library called Anette did something with Js. I'll see how they did it.

anissen commented 8 years ago

Great that you'll look into this! :+1: For reference, here is a simple example of a Luxe game using WebSockets to communicate with a node.js-server.

5Mixer commented 8 years ago

Alright, so I've done some work on the server side of this, as you can see in this commit 43ef439. Alot of the work was already done in HxNet. Now I just need to do the client, and that's easy as haxe has js.html.WebSocket; as you showed with that link.

Once that is done, I'll see if I have the time to make a luxe example, and this issue should be closed :+1:

anissen commented 8 years ago

Really awesome! :clap: Let me know if you don't have time to make a Luxe example then I'll cook up something :)

5Mixer commented 8 years ago

Thanks for the example! Closing this, because although the websocket target isn't yet perfect, and has some bugs, those bugs should really be brought up in their own issue. Thanks!