hxsocketio 0.0.2

Externs for socket.io

Released 2016-12-14.

To install, run:

haxelib install hxsocketio 0.0.2

See using Haxelib in Haxelib documentation for more information.

Maintainergogoprog
Websitehttps://github.com/gogoprog/hxsocketio/
Current version0.0.2
StatisticsInstalled 12 times
LicenseMIT
Tags js, node, socket, socket.io, socketio

README.md

hxsocketio

Haxe externs for socket.io. Support for Haxe JavaScript target.

Basic usage

Server

import js.node.socketio.*;

class ServerTest
{
    static public function main()
    {
        var server = new Server();

        server.listen(8000);

        server.on(
            'connection',
            function(socket:Socket)
            {
                socket.emit('message', { content: 'Hello World!' });

                socket.on('message',
                    function (data)
                    {
                        // Do something
                    });
            }
        );
    }
}

Client

Both browser and Node.js JavaScript are supported.

import js.node.socketio.*;

class ClientTest
{
    static public function main()
    {
        var client = new Client("http://localhost:8000/");

        client.on('message',
            function (data)
            {
                // Do something
            });
    }
}