hxsocketio 0.1.0

Externs for socket.io

Released 2017-10-22.

To install, run:

haxelib install hxsocketio 0.1.0

See using Haxelib in Haxelib documentation for more information.

Maintainergogoprog
Websitehttps://github.com/gogoprog/hxsocketio/
Current version0.1.0
StatisticsInstalled 35 times
LicenseMIT
Tags

README.md

hxsocketio

Haxe externs for socket.io.

Basic usage

Requirements

  • Only Haxe JavaScript target supported
  • Socket.io npm modules

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
            });
    }
}