问题描述:

i try to find a good combination of libraries for managing a real-time communication (client/server) using Haxe (only Haxe, not openfl or other framework base on Haxe) targeting flash (swf) for the client and no preference for the server except don't use neko.

The goal is to make a simple tchat and put a display representation of all clients on an aera. Each client can move his representation in this area, and the other sees the movement.

I find some Lib to make this :

  • https://github.com/soywiz/haxe-ws
  • https://github.com/MattTuttle/hxnet
  • haxe-js-kit

But I'm not sure of the best way to adopt.

Do you have any suggestion/remarks/tips to choose the better way ?

网友答案:

Disclaimer: I wrote the library that I am sharing here.

My somewhat new library mphx may be able to help you. It can manage 'rooms' of connections, allows client to server and server to client messaging in the form of events, and best of all, is cross platform. It also works in the web with websockets.

It was originally an extention of HxNet, however I wanted it to be easier to use. Connecting and sending a 'message' with data just takes a few lines.

I have a few examples in the github repository, the simplest being the 'basic' example. One of your requests you have is that it doesn't rely on one of the big libraries (open fl, etc) and mphx doesn't. The basic example proves that, and only runs in terminal. That being said, it can be used with haxeflixel, for that you can see the other examples.

It sounds like your main goal is to have simple, graphic multiplayer. For that you can look at the 'movement' haxeflixel example.

Documentation is still a little skim, and the code is alpha, so it might change or break. That can probably be said for most of the library's you listed though. The best way to install it is like this

haxelib git mphx https://github.com/5Mixer/mphx.git

That will not install the examples though. To run them, either download the repository as a zip, or just git clone it, and go into the examples folder.

Library: https://github.com/5Mixer/mphx

Old video's I made. A little outdated, most likely. Video 1: https://www.youtube.com/watch?v=07J0wLXwH0g Video 2: https://www.youtube.com/watch?v=MUx2CUtsnTU

相关阅读:
Top