Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tylertreat/vessel.js
Vessel messaging client.
https://github.com/tylertreat/vessel.js
Last synced: 4 days ago
JSON representation
Vessel messaging client.
- Host: GitHub
- URL: https://github.com/tylertreat/vessel.js
- Owner: tylertreat
- License: apache-2.0
- Created: 2014-09-20T02:25:48.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2014-11-21T22:31:50.000Z (almost 10 years ago)
- Last Synced: 2023-07-05T14:20:23.494Z (over 1 year ago)
- Language: JavaScript
- Homepage: https://github.com/tylertreat/vessel
- Size: 238 KB
- Stars: 3
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
vessel.js
=========[Vessel](https://github.com/tylertreat/vessel) is a fast, asynchronous client-server messaging library. Send, receive, and subscribe to messages over channels. By default, websockets are used for communication while falling back to other transports if necessary. Messaging via HTTP polling is also supported.
```javascript
var vessel = new Vessel('http://localhost:8081/vessel');vessel.onMessage(function(channel, message) {
// Fire whenever a message is received.
console.log(channel + ': ' + message);
});vessel.subscribe('notifications', function(message) {
// Fire whenever a message is received on the 'notifications' channel.
console.log(message);
});// Send a message on the 'foo' channel.
vessel.send('foo', 'hello world!');// Send another message on the 'foo' channel but listen for a response.
vessel.send('foo', 'is this thing on?', function(message) {
// Fire when a response to this message is received.
console.log(message);
});
```