mardi 10 janvier 2017

as3-websocket-server, how to manage the results

I downloaded the library as3-websocket-server ( http://ift.tt/2if9wj5 ) for a desktop air app and I'm trying to manage the results.

I'm using Flash professional, so I import the code by:

import com.childoftv.websockets.WebSocketServer;

Than I'm able to run the server by:

var sock:WebSocketServer = new WebSocketServer();
sock.attemptBind(8087,"127.0.0.1");

It works fine with an html5 client on any browser (I see it adding some trace in the .as file). But how can I manage the data I get from the browser directly in the main FLA file?

Instructions say to see WebSocketServerBasic.as but it neither works: I get error on invalid number of arguments (max1) calling the function WebSocketServerBasic.

So I'm using the main WebSocketServer.as But I don't find any code to manage the results... I should need something like:

sock.onMessageReceived (do something with the message...) 

or some addEventListener...

Any suggestion?

Thanks!

Aucun commentaire:

Enregistrer un commentaire