imoapi

0.2.2 • Public • Published

imoapi-nodejs

Usage of this library is kept as similar as possible to the browser-based API, so this document assumes you already have familiarity with it. If not, check out the official documentation.

Example

The IMO.Channel constructor takes two extra parameters: the ch_id of the channel you're connecting to, and optionally the token (the part that comes after the #). The token can include or omit the # symbol, and if you don't provide a token, one will be created for you. Other than that, nothing major changes:

var IMO = require('imoapi');

var channel = null;

function connect(){
	var client = {
		connect: function(){
			console.log("Connected! :)");
			channel.subscribe([{type: "event_queue", name: "message"}], 0);
		},
		event_queue: function(name, event){
			console.log(name, event);
		}
	};
	return new IMO.Channel(client, "12345678901234567890", "#qwertyuiopzxcvbnm");
};

channel = connect();

Caveats / To Do

  • The server message session_expired is not handled.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.2.2
    2
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.2.2
    2
  • 0.2.1
    0
  • 0.2.0
    1
  • 0.1.1
    1
  • 0.1.0
    0

Package Sidebar

Install

npm i imoapi

Weekly Downloads

4

Version

0.2.2

License

MIT

Last publish

Collaborators

  • danh42