Skip to content

phated/enyo-socket.io

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Enyo-Socket.io

Socket.io wrapper for EnyoJS

Example

Can be used in much the same way as Socket.io

var socket = new Socket();
socket.on('example', function(data){
  console.log(data);
});

Can also be passed a map of key-value pairs for on()

var socket = new Socket();
socket.on({
  example: function(data){
    console.log(data);
  },
  example2: function(data){
    console.log(data);
  }
});

Constructor can take an initial map of key-value pairs that will be passed to on() during instantiation

var socket = new Socket({
  init: {
    on: {
      example: function(data){
        console.log(data);
      },
      example2: function(data){
        console.log(data);
      }
    }
  }
});

Convenience function for emit exists on Socket

var socket = new Socket();
socket.emit('example', 'example data');

Socket.io address can be configured on instantiation (Defaults to window.location.host)

var socket = new Socket({
  address: 127.0.0.1
});

Socket.io configuration options can be passed to constructor as connOptions

var socket = new Socket({
  connOptions: {
    transports: ['websocket']
  }
});

TODO

Enyo Tests

Solidify API

About

Socket.io wrapper for enyo.js

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published