Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
bearychat-rtm-client
Advanced tools
Compatible with Node.js, Webpack and Browserify.
npm install bearychat-rtm-client --save
or with yarn
yarn add bearychat-rtm-client
constructor({ url, WebSocket })
Param | Description |
---|---|
url | a websocket url or a function returns a promise that resolves to a websocket url |
WebSocket | a W3C compatible WebSocket client implement |
RTMClient uses native WebSocket in browser.
import bearychat from 'bearychat';
import RTMClient from 'bearychat-rtm-client';
const RTMClientEvents = RTMClient.RTMClientEvents;
const client = new RTMClient({
url() {
return bearychat.rtm.start({token: '<your hubot token>'})
.then(resp => resp.json())
.then(data => data.ws_host);
}
});
client.on(RTMClientEvents.ONLINE, function() {
console.log('RTM online');
});
client.on(RTMClientEvents.OFFLINE, function() {
console.log('RTM offline');
});
client.on(RTMClientEvents.EVENT, function(message) {
console.log('event message received: ', message);
});
client.send({
// your message body
});
RTMClient need a W3C compatible WebSocket client implement. ws version 3.0.0+ is recommended.
const bearychat = require('bearychat');
const RTMClient = require('bearychat-rtm-client');
const RTMClientEvents = RTMClient.RTMClientEvents;
const WebSocket = require('ws');
const client = new RTMClient({
url: function() {
return bearychat.rtm.start({token: '<your hubot token>'})
.then(function (resp) {return resp.json()})
.then(function (data) {return data.ws_host});
},
WebSocket: WebSocket
});
client.on(RTMClientEvents.ONLINE, function() {
console.log('RTM online');
});
client.on(RTMClientEvents.OFFLINE, function() {
console.log('RTM offline');
});
client.on(RTMClientEvents.EVENT, function(message) {
console.log('event message received: ', message);
});
client.send({
// your message body
});
Event | Description |
---|---|
RTMClientEvents.ONLINE | client connected |
RTMClientEvents.OFFLINE | client disconnected |
RTMClientEvents.CLOSE | client closed |
RTMClientEvents.EVENT | receive event message from server |
RTMClientEvents.ERROR | error occurred |
INITIAL
+
error |
+-------------+ |
v + v connect
RECONNECT+------->CONNECTING<---------+CLOSED
^ + ^
| | |
| server | |
| close/ v close +
+------------+CONNECTED+---------->CLOSING
error
MIT
FAQs
RTM client for BearyChat
We found that bearychat-rtm-client demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.