4

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 :

But I'm not sure of the best way to adopt. Do you have any suggestion/remarks/tips to choose the better way ?

Gama11
  • 31,714
  • 9
  • 78
  • 100
yansucc
  • 43
  • 6
  • If you want to communicate with other languages as well, Apache Thrift has Haxe bindings for a while. Just saying. – JensG Mar 09 '16 at 16:09

1 Answers1

5

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

5Mixer
  • 541
  • 4
  • 10
  • 1
    it sounds like great ! i will try your library with the hope that it works with our tech (but it seems) ! Man, i think that you made my day ! great thanks ! – yansucc Mar 09 '16 at 10:13
  • @Mixerman123 I'm looking at this example [server](https://github.com/5Mixer/mphx/blob/master/example/basic/server/Main.hx) and the [client](https://github.com/5Mixer/mphx/blob/master/example/basic/client/Main.hx) that it talks to. On the server, I can see that a "room" is being created, but it isn't exactly too clear how a client joins a particular room, AFAICT it just joins the server. Would it be possible to create an example where clients can join different rooms, and the send messages only to the other clients in the same room, but not ones that may be connected but belong to other rooms? – bguiz Mar 14 '16 at 23:48
  • @bquiz Sure! I just made an example then. https://github.com/5Mixer/mphx/tree/master/example/basic/rooms Not a fantastic example, but it works. Try creating lots of clients and seeing how it sends a message to the whole room. In the future I might create an actual chat app with rooms, but this will do fine for now. Rooms are really just arrays of connections. https://github.com/5Mixer/mphx/blob/master/mphx/server/Room.hx Keep in mind that this is all alpha still and the room api may grow and change. – 5Mixer Mar 17 '16 at 09:27