WebSocket emulation - Node.js server

Overview

SockJS-node

npm versionDependencies

SockJS for enterprise

Available as part of the Tidelift Subscription.

The maintainers of SockJS and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. Learn more.

SockJS family

Work in progress:

⚠️ ATTENTION This is pre-release documentation. The documentation for the latest stable release is at: https://github.com/sockjs/sockjs-node/tree/v0.3.19 ⚠️

What is SockJS?

SockJS is a JavaScript library (for browsers) that provides a WebSocket-like object. SockJS gives you a coherent, cross-browser, Javascript API which creates a low latency, full duplex, cross-domain communication channel between the browser and the web server, with WebSockets or without. This necessitates the use of a server, which this is one version of, for Node.js.

SockJS-node server

SockJS-node is a Node.js server side counterpart of SockJS-client browser library.

To install sockjs-node run:

npm install sockjs

A simplified echo SockJS server could look more or less like:

const http = require('http');
const sockjs = require('sockjs');

const echo = sockjs.createServer({ prefix:'/echo' });
echo.on('connection', function(conn) {
  conn.on('data', function(message) {
    conn.write(message);
  });
  conn.on('close', function() {});
});

const server = http.createServer();
echo.attach(server);
server.listen(9999, '0.0.0.0');

(Take look at examples directory for a complete version.)

Subscribe to SockJS mailing list for discussions and support.

SockJS-node API

The API design is based on common Node APIs like the Streams API or the Http.Server API.

Server class

SockJS module is generating a Server class, similar to Node.js http.createServer module.

const sockjs_server = sockjs.createServer(options);

Where options is a hash which can contain:

sockjs_url (string, required)
Transports which don't support cross-domain communication natively ('eventsource' to name one) use an iframe trick. A simple page is served from the SockJS server (using its foreign domain) and is placed in an invisible iframe. Code run from this iframe doesn't need to worry about cross-domain issues, as it's being run from domain local to the SockJS server. This iframe also does need to load SockJS javascript client library, and this option lets you specify its url (if you're unsure, point it to the latest minified SockJS client release, this is the default). You must explicitly specify this url on the server side for security reasons - we don't want the possibility of running any foreign javascript within the SockJS domain (aka cross site scripting attack). Also, sockjs javascript library is probably already cached by the browser - it makes sense to reuse the sockjs url you're using in normally.
prefix (string regex)
A url prefix for the server. All http requests which paths begins with selected prefix will be handled by SockJS. All other requests will be passed through, to previously registered handlers.
response_limit (integer)
Most streaming transports save responses on the client side and don't free memory used by delivered messages. Such transports need to be garbage-collected once in a while. `response_limit` sets a minimum number of bytes that can be send over a single http streaming request before it will be closed. After that client needs to open new request. Setting this value to one effectively disables streaming and will make streaming transports to behave like polling transports. The default value is 128K.
transports (Array of strings)
List of transports to enable. Select from `eventsource`, `htmlfile`, `jsonp-polling`, `websocket`, `websocket-raw`, `xhr-polling`, and `xhr-streaming`.
jsessionid (boolean or function)
Some hosting providers enable sticky sessions only to requests that have JSESSIONID cookie set. This setting controls if the server should set this cookie to a dummy value. By default setting JSESSIONID cookie is disabled. More sophisticated behaviour can be achieved by supplying a function.
log (function(severity, message))
It's quite useful, especially for debugging, to see some messages printed by a SockJS-node library. This is done using this `log` function, which is by default set to nothing. If this behaviour annoys you for some reason, override `log` setting with a custom handler. The following `severities` are used: `debug` (miscellaneous logs), `info` (requests logs), `error` (serious errors, consider filing an issue).
heartbeat_delay (milliseconds)
In order to keep proxies and load balancers from closing long running http requests we need to pretend that the connection is active and send a heartbeat packet once in a while. This setting controls how often this is done. By default a heartbeat packet is sent every 25 seconds.
disconnect_delay (milliseconds)
The server sends a `close` event when a client receiving connection have not been seen for a while. This delay is configured by this setting. By default the `close` event will be emitted when a receiving connection wasn't seen for 5 seconds.
disable_cors (boolean)
Enabling this option will prevent CORS headers from being included in the HTTP response. Can be used when the sockjs client is known to be connecting from the same origin as the sockjs server. This also disables the iframe HTML endpoint.

Server instance

Once you have create Server instance you can hook it to the http.Server instance.

var http_server = http.createServer();
sockjs_server.attach(http_server);
http_server.listen(...);

Server instance is an EventEmitter, and emits following event:

Event: connection (connection)
A new connection has been successfully opened.

All http requests that don't go under the path selected by prefix will remain unanswered and will be passed to previously registered handlers. You must install your custom http handlers before calling attach. You can remove the SockJS handler later with detach.

Connection instance

A Connection instance supports Node Stream API and has following methods and properties:

Property: remoteAddress (string)
Last known IP address of the client.
Property: remotePort (number)
Last known port number of the client.
Property: address (object)
Hash with 'address' and 'port' fields.
Property: headers (object)
Hash containing various headers copied from last receiving request on that connection. Exposed headers include: `origin`, `referer` and `x-forwarded-for` (and friends). We explicitly do not grant access to `cookie` header, as using it may easily lead to security issues (for details read the section "Authorisation").
Property: url (string)
Url property copied from last request.
Property: pathname (string)
`pathname` from parsed url, for convenience.
Property: prefix (string)
Prefix of the url on which the request was handled.
Property: protocol (string)
Protocol used by the connection. Keep in mind that some protocols are indistinguishable - for example "xhr-polling" and "xdr-polling".
Property: readyState (integer)
Current state of the connection: 0-connecting, 1-open, 2-closing, 3-closed.
write(message)
Sends a message over opened connection. A message must be a non-empty string. It's illegal to send a message after the connection was closed (either after 'close' or 'end' method or 'close' event).
close([code], [reason])
Asks the remote client to disconnect. 'code' and 'reason' parameters are optional and can be used to share the reason of disconnection.
end()
Asks the remote client to disconnect with default 'code' and 'reason' values.

A Connection instance emits the following events:

Event: data (message)
A message arrived on the connection. Message is a unicode string.
Event: close ()
Connection was closed. This event is triggered exactly once for every connection.

For example:

sockjs_server.on('connection', function(conn) {
  console.log('connection' + conn);
  conn.on('close', function() {
    console.log('close ' + conn);
  });
  conn.on('data', function(message) {
    console.log('message ' + conn, message);
  });
});

Footnote

A fully working echo server does need a bit more boilerplate (to handle requests unanswered by SockJS), see the echo example for a complete code.

Examples

If you want to see samples of running code, take a look at:

Connecting to SockJS-node without the client

Although the main point of SockJS it to enable browser-to-server connectivity, it is possible to connect to SockJS from an external application. Any SockJS server complying with 0.3 protocol does support a raw WebSocket url. The raw WebSocket url for the test server looks like:

  • ws://localhost:8081/echo/websocket

You can connect any WebSocket RFC 6455 compliant WebSocket client to this url. This can be a command line client, external application, third party code or even a browser (though I don't know why you would want to do so).

Note: This endpoint will not send any heartbeat packets.

Deployment and load balancing

There are two issues that need to be considered when planning a non-trivial SockJS-node deployment: WebSocket-compatible load balancer and sticky sessions (aka session affinity).

WebSocket compatible load balancer

Often WebSockets don't play nicely with proxies and load balancers. Deploying a SockJS server behind Nginx or Apache could be painful.

Fortunately recent versions of an excellent load balancer HAProxy are able to proxy WebSocket connections. We propose to put HAProxy as a front line load balancer and use it to split SockJS traffic from normal HTTP data. Take a look at the sample SockJS HAProxy configuration.

The config also shows how to use HAproxy balancing to split traffic between multiple Node.js servers. You can also do balancing using dns names.

Sticky sessions

If you plan deploying more than one SockJS server, you must make sure that all HTTP requests for a single session will hit the same server. SockJS has two mechanisms that can be useful to achieve that:

  • Urls are prefixed with server and session id numbers, like: /resource/<server_number>/<session_id>/transport. This is useful for load balancers that support prefix-based affinity (HAProxy does).
  • JSESSIONID cookie is being set by SockJS-node. Many load balancers turn on sticky sessions if that cookie is set. This technique is derived from Java applications, where sticky sessions are often necessary. HAProxy does support this method, as well as some hosting providers, for example CloudFoundry. In order to enable this method on the client side, please supply a cookie:true option to SockJS constructor.

Development and testing

If you want to work on SockJS-node source code, you need to clone the git repo and follow these steps. First you need to install dependencies:

cd sockjs-node
npm install

If compilation succeeds you may want to test if your changes pass all the tests. Currently, there are two separate test suites.

SockJS-protocol Python tests

To run it run something like:

./scripts/test.sh

For details see SockJS-protocol README.

SockJS-client Karma tests

To run it run something like:

cd sockjs-client
npm run test:browser_local

For details see SockJS-client README.

Various issues and design considerations

Authorisation

SockJS-node does not expose cookies to the application. This is done deliberately as using cookie-based authorisation with SockJS simply doesn't make sense and will lead to security issues.

Cookies are a contract between a browser and an http server, and are identified by a domain name. If a browser has a cookie set for particular domain, it will pass it as a part of all http requests to the host. But to get various transports working, SockJS uses a middleman

  • an iframe hosted from target SockJS domain. That means the server will receive requests from the iframe, and not from the real domain. The domain of an iframe is the same as the SockJS domain. The problem is that any website can embed the iframe and communicate with it - and request establishing SockJS connection. Using cookies for authorisation in this scenario will result in granting full access to SockJS communication with your website from any website. This is a classic CSRF attack.

Basically - cookies are not suited for SockJS model. If you want to authorise a session - provide a unique token on a page, send it as a first thing over SockJS connection and validate it on the server side. In essence, this is how cookies work.

Deploying SockJS on Heroku

Long polling is known to cause problems on Heroku, but workaround for SockJS is available.

Comments
  • Lots of connections in CLOSED state

    Lots of connections in CLOSED state

    Hi, I'm on FreeBSD9, node 0.8.15, sockjs 0.3.4 After the application is running for a few hours, i have lots of connections with CLOSED state in netstat, after killing the nodejs process, this conncetions dissapear, when i had a lower fds limit the process died with "accept EMFILE", same stacktrace as https://github.com/sockjs/sockjs-node/issues/94 , not sure if thats a node issue or sockjs issue not disposing sockets properly

    Here is output after the app ran for ~18 hours:

    netstat -an -p tcp | awk '{print $6}' | sort | uniq -c | sort -n echo sysctl kern.openfiles

    output => 4 LISTEN 29 FIN_WAIT_1 73 TIME_WAIT 78 FIN_WAIT_2 489 CLOSE_WAIT 3454 ESTABLISHED 14590 CLOSED kern.openfiles: 18652

    Not sure how to debug it further, any advice?

    opened by yurynix 52
  • Connection.cookies : read cookies sent by the client

    Connection.cookies : read cookies sent by the client

    When remote client and SockJS server share the same domain, they can share cookies. It is useful to get those cookies server-side, so the server hosting SockJS can authenticate remote clients against the server hosting the website (and do stuff like grant permissions). Dress-shoe does this by wrapping method calls, but cookies are supposed to work well with websockets... I tested this with websocket hybi10 on chromium 14.

    opened by kapouer 28
  • Error: A wildcard '*' cannot be used in the 'Access-Control-Allow-Origin'

    Error: A wildcard '*' cannot be used in the 'Access-Control-Allow-Origin'

    Hi

    I'm running node-server in windows in my local computer. With sockjs-client 1.0.0-beta.12 (I use browserify for bundle the frontend), when I try to connect chrome gives me this error:

    XMLHttpRequest cannot load http://localhost:12540/websocket/info?t=1429552020306. A wildcard '*' cannot be used in the 'Access-Control-Allow-Origin' header when the credentials flag is true. Origin 'null' is therefore not allowed access.

    It's my fault or is a error from the beta version?

    client

    Net.prototype.connect = function(url, port, prefix) { //url: 'localhost', port: 12540, prefix: '/websocket'
        var _this = this;
    
        return new Promise(function (resolve, reject) {
    
            _this.sock = new SockJS('http://' + url + ':' + port + prefix);
    
            _this.sock.onopen = resolve.bind(null, _this);
            _this.sock.onmessage = _this._message.bind(_this);
            _this.sock.onclose = _this._close.bind(_this);
        });
    };
    

    server

    Net.prototype.start = function(port, prefix) { //port: 12540, prefix: '/websocket'
        this.sockjs = Sockjs.createServer({ sockjs_url: 'http://cdn.jsdelivr.net/sockjs/0.3.4/sockjs.min.js' });
    
        var server = http.createServer();
        this.sockjs.installHandlers(server, {prefix: prefix});
        server.listen(port, '0.0.0.0');
        return this;
    };
    
    opened by DavidBM 27
  • random INVALID_STATE_ERR errors thrown causing program to crash

    random INVALID_STATE_ERR errors thrown causing program to crash

    Hello, I'm using sockjs for a multiplayer game server, and I'm getting random INVALID_STATE_ERR errors. I didn't find a test case that reproduce it, seems just to happen randomly.

    the problem is that this error is thrown, and I don't know how or where to catch it to prevent server from crashing .

    what can cause this error ? and how to catch it ?

    opened by alaa-eddine 20
  • Close event not fired on Heroku

    Close event not fired on Heroku

    Hello im experimenting with sockjs and when testing on localhost the close event fires and gives all connected users the message that a user just leave. But when i put my app on a online server it doesn´t fire that event!!

    You can check it here. http://er-u-count.herokuapp.com/

    var cons = {};

    var sockjs_echo = sockjs.createServer(sockjs_opts); sockjs_echo.on('connection', function(conn) { console.log('connection' + conn);

    //SAY WELCOME conn.write("Welcome"); //NOTIFY OTHER USERS THAT WE HAVE ARRIVED broadcastmsg(conn.sesion+" Joined");

    cons[conn.id] = conn;
    
    conn.on('data', function(message){
        broadcastmsg(conn.sesion+" SAY: "+message);
    });
    
    conn.on('close', function() {
        console.log('close ' + conn);
        delete cons[conn.sesion];
        broadcastmsg(conn.sesion+" is leaving");
    });
    

    });

    //HELPERS function broadcastmsg(msg){ for(c in cons){ cons[c].write(msg); } }

    Is there any way to see if a connection is still on?

    opened by eralha 19
  • Connection object is null

    Connection object is null

    I see this many times a day in the logs. The relevant snippet of my code looks like this:

    sockServer.on('connection', function(conn) {
      console.log(conn);   // This is null sometimes, I don't see how that can be.
      if (_.isNull(conn)) {
        return;
      }
      conn.on('data', function(message) {
        // Let's see what's in this message.
        handleMessage(message, conn);
      });
      conn.on('close', function() {
        channels.manager.removeConnection(conn);
      });
    });
    
    server = https.createServer(sslOptions);
    sockServer.installHandlers(server, {prefix: '/socket'});
    server.listen(9999, '0.0.0.0');
    
    opened by domino14 13
  • unable to connect from iphone client.

    unable to connect from iphone client.

    Hi guys,

    I have a piece of server sample code, using sockJS, that simply echos any incoming data:

    var http = require('http');
    var sockjs = require('sockjs');
    var echo = sockjs.createServer();
        echo.on('connection', function(conn) {
            conn.on('data', function(message) {
                conn.write(message);
            });
            conn.on('close', function() {});
        });
    var server = http.createServer();
    var port = process.env.PORT || 5000;
    echo.installHandlers(server, {prefix:'/echo'});
    server.listen(port, '0.0.0.0');
    console.log("started Server v0.0.1 on " + port);
    

    My client is an iphone app. I picked SocketRocket library to establish the websocket connection. When I try to connect it locally on my machine. It works. My client code looks like this:

    SRWebSocket *socket = [[SRWebSocket alloc] initWithURL:[NSURL                 URLWithString:@"http://10.0.1.2:5000/echo/websocket"]];
    socket.delegate = self;
    [socket open];
    

    But, if I put the server codes on heroku server and try to connect to it from iPhone app, it will never work regardless of what URL I tried:

    socket = [[SRWebSocket alloc] initWithURL:[NSURL URLWithString:@"http://rocky-atoll-7445.herokuapp.com/"]];
    socket = [[SRWebSocket alloc] initWithURL:[NSURL URLWithString:@"http://rocky-atoll-7445.herokuapp.com/echo"]];
    socket = [[SRWebSocket alloc] initWithURL:[NSURL URLWithString:@"http://rocky-atoll-7445.herokuapp.com/echo/websocket"]];
    

    Am I missing something here?

    EDIT: Besides that, even though I failed to connect from the iPhone client, I tried to connect to the heroku server using a sockJs node client and this works:

    var sjsc = require('sockjs-client');
    var client = sjsc.create("http://rocky-atoll-7445.herokuapp.com/echo");
    client.on('connection', function ()
    { // connection is established
        console.log("connection established");
        client.write("hi!");
    });
    client.on('error', function (e)
    { // something went wrong
        console.log("something went wrong " + e);
    });
    client.on('data', function (msg)
    { // received some data
        console.log("received data from server: " + msg);
    });
    
    opened by magickaito 13
  • TypeError: Cannot call method 'addListener' of undefined

    TypeError: Cannot call method 'addListener' of undefined

    Hi,

    we're running quite a busy SockJS 0.3.3 server (4000 concurrent connections), and sometimes see this error in our logs:

    error   Exception on "POST /stream/547/88ni42ue/xhr" in filter "xhr_poll":
    TypeError: Cannot call method 'addListener' of undefined
        at XhrPollingReceiver.GenericReceiver.setUp (/usr/lib/node_modules/socket-redis/node_modules/sockjs/lib/transport.js:268:19)
        at XhrPollingReceiver.GenericReceiver (/usr/lib/node_modules/socket-redis/node_modules/sockjs/lib/transport.js:260:12)
        at XhrPollingReceiver.ResponseReceiver (/usr/lib/node_modules/socket-redis/node_modules/sockjs/lib/transport.js:326:46)
        at XhrPollingReceiver.XhrStreamingReceiver (/usr/lib/node_modules/socket-redis/node_modules/sockjs/lib/trans-xhr.js:15:50)
        at new XhrPollingReceiver (/usr/lib/node_modules/socket-redis/node_modules/sockjs/lib/trans-xhr.js:33:48)
        at App.exports.app.xhr_poll (/usr/lib/node_modules/socket-redis/node_modules/sockjs/lib/trans-xhr.js:104:37)
        at execute_request (/usr/lib/node_modules/socket-redis/node_modules/sockjs/lib/webjs.js:21:38)
        at IncomingMessage.exports.generateHandler.req.next_filter (/usr/lib/node_modules/socket-redis/node_modules/sockjs/lib/webjs.js:95:18)
        at Listener.exports.generateHandler [as webjs_handler] (/usr/lib/node_modules/socket-redis/node_modules/sockjs/lib/webjs.js:97:13)
        at Listener.handler (/usr/lib/node_modules/socket-redis/node_modules/sockjs/lib/sockjs.js:141:12)
    

    It's not often, around 10 times a day.

    Kind regards

    opened by njam 13
  • ERR_STREAM_WRITE_AFTER_END when issuing upgrade request on non-existent URL

    ERR_STREAM_WRITE_AFTER_END when issuing upgrade request on non-existent URL

    On version 0.3.19 (and I believe in 0.4 also), when issuing upgrade request on wrong URL i.e. /prefix/wrongpath, fake_response calls res.end() in a try..catch block and then res.end() is being called for the second time in handle_404 method - which throws...

    bug 
    opened by jfedyczak 12
  • sockjs on npm is missing lib/

    sockjs on npm is missing lib/

    To reproduce:

    $ npm install sockjs
    $ node
    > require('sockjs')
    Error: Cannot find module './lib/sockjs'
        at Function.Module._resolveFilename (module.js:338:15)
        at Function.Module._load (module.js:280:25)
        at Module.require (module.js:362:17)
        at require (module.js:378:17)
        at Object.<anonymous> (/home/substack/projects/scratch/s/node_modules/sockjs/index.js:1:80)
        at Module._compile (module.js:449:26)
        at Object.Module._extensions..js (module.js:467:10)
        at Module.load (module.js:356:32)
        at Function.Module._load (module.js:312:12)
        at Module.require (module.js:362:17)
    > ^D
    $ ls node_modules/sockjs/
    Changelog  COPYING  examples  index.js  LICENSE-MIT-SockJS  Makefile  node_modules  package.json  README.md
    
    opened by ghost 12
  • "Could not decode a text frame as UTF-8."

    That error is what Chrome produces in some very rare cases. I'm suspecting, because I'm relaying information from other sources, that some funky Unicode has slipped it, but I'm not sure what.

    Socket.io has a similar bug report open: https://github.com/LearnBoost/socket.io/issues/572

    Sorry if this is vague. Figured it'd be a good idea to at least document it. I hope to be able to reproduce this soon.

    opened by stephank 12
  • TypeError: echo.attach is not a function

    TypeError: echo.attach is not a function

    I just use the sample code, "A simplified echo SockJS server" on readme, but I got the error message

    echo.attach(server);
         ^
    
    TypeError: echo.attach is not a function
    

    But I see attach() does exist at https://github.com/sockjs/sockjs-node/blob/main/lib/server.js#L58 so I can't figure out why.

    opened by qiulang 2
  • Bump minimist from 1.2.5 to 1.2.6

    Bump minimist from 1.2.5 to 1.2.6

    Bumps minimist from 1.2.5 to 1.2.6.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • [QUESTION] List of connections

    [QUESTION] List of connections

    Is there a property/method on the Server instance that contains the list of connections? Or should I manually maintain this using an array, and push new client connections on the connection event to this array?

    I am using the 0.3.24 release.

    opened by go4cas 0
  • Bump ajv from 6.12.2 to 6.12.6

    Bump ajv from 6.12.2 to 6.12.6

    Bumps ajv from 6.12.2 to 6.12.6.

    Release notes

    Sourced from ajv's releases.

    v6.12.6

    Fix performance issue of "url" format.

    v6.12.5

    Fix uri scheme validation (@​ChALkeR). Fix boolean schemas with strictKeywords option (#1270)

    v6.12.4

    Fix: coercion of one-item arrays to scalar that should fail validation (failing example).

    v6.12.3

    Pass schema object to processCode function Option for strictNumbers (@​issacgerges, #1128) Fixed vulnerability related to untrusted schemas (CVE-2020-15366)

    Commits
    • fe59143 6.12.6
    • d580d3e Merge pull request #1298 from ajv-validator/fix-url
    • fd36389 fix: regular expression for "url" format
    • 490e34c docs: link to v7-beta branch
    • 9cd93a1 docs: note about v7 in readme
    • 877d286 Merge pull request #1262 from b4h0-c4t/refactor-opt-object-type
    • f1c8e45 6.12.5
    • 764035e Merge branch 'ChALkeR-chalker/fix-comma'
    • 3798160 Merge branch 'chalker/fix-comma' of git://github.com/ChALkeR/ajv into ChALkeR...
    • a3c7eba Merge branch 'refactor-opt-object-type' of github.com:b4h0-c4t/ajv into refac...
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Configuring access-control-allow-origin for development environment purposes

    Configuring access-control-allow-origin for development environment purposes

    Imagine a situation, where you are running the service on one port and the frontend dev server on another. It's impossible to use sockjs connections, because it will end up with CORS error (origin differs from the backend server url).

    How about enable configuring the default response header for Access-Control-Allow-Origin in middleware.js#L123? If you are worried about the potential of unintended security flaws then add an explicit check to not allow overriding it in production environment.

    opened by sysaxis 3
Releases(v0.3.24)
  • v0.3.24(Dec 3, 2021)

  • v0.3.23(Dec 3, 2021)

  • v0.3.22(Dec 3, 2021)

  • v0.3.21(Jul 31, 2020)

  • v0.3.20(Mar 26, 2020)

    • Updated node-uuid and coffeescript
    • Exclude examples, tests, and Makefile from npm package
    • Update examples to use latest jQuery and sockjs-client #271
    • Don't call res.end in writeHead #266
    • Pin websocket-driver as later versions cause some tests from sockjs-protocol to fail
    Source code(tar.gz)
    Source code(zip)
  • v0.3.19(Oct 12, 2017)

    • Update node-uuid version #224
    • Add disable_cors option to prevent CORS headers from being added to responses #218
    • Add dnt header to whitelist #212
    • Add x-forwarded-host and x-forwarded-port headers to whitelist #208
    • Update sockjs_url default to latest 1.x target #223
    • Updated hapi.js example #216
    Source code(tar.gz)
    Source code(zip)
  • v0.3.18(Oct 12, 2017)

  • v0.3.17(Apr 29, 2016)

  • v0.3.15(Mar 11, 2015)

  • v0.3.13(Feb 26, 2015)

  • v0.3.10(Oct 24, 2014)

    • #168 - Add CORS headers for eventsource
    • #158 - schedule heartbeat timer even if send_buffer is not empty
    • #96 - remove rbytes dependency
    • #83 - update documentation for prefix
    • #163 - add protection to JSON for SWF exploit
    • #104 - delete unused parameters in code
    • #106 - update CDN urls
    • #79 - Don't remove stream listeners until after end so 'close' event is heard
    • Get rid of need for _sockjs_onload global variable
    • Use Faye for websocket request validation
    • Upgrade Faye to 0.7.3
    • Upgrade node-uuid to 1.4.1
    Source code(tar.gz)
    Source code(zip)
Owner
SockJS
WebSocket emulation
SockJS
Simple to use, blazing fast and thoroughly tested WebSocket client and server for Node.js

ws: a Node.js WebSocket library ws is a simple to use, blazing fast, and thoroughly tested WebSocket client and server implementation. Passes the quit

WebSockets 19.2k Jan 4, 2023
This Repository implements an Authenticated Websocket Server built in Node Js along ws library.

websockets-authentication-server This Repository implements an Authenticated Websocket Server built in Node Js along ws library. Features Authenticate

M.Abdullah Ch 7 May 5, 2023
Standards-compliant WebSocket client and server

faye-websocket This is a general-purpose WebSocket implementation extracted from the Faye project. It provides classes for easily building WebSocket s

null 588 Dec 23, 2022
A WebSocket Implementation for Node.JS (Draft -08 through the final RFC 6455)

WebSocket Client & Server Implementation for Node Overview This is a (mostly) pure JavaScript implementation of the WebSocket protocol versions 8 and

Brian McKelvey 3.6k Dec 30, 2022
Mini Projeto de um chat-app usando o protocolo WebSocket através da lib 'ws' do node.js

CHAT-APP-WEBSOCKET Mini Projeto de um chat-app usando o protocolo WebSocket através da lib 'ws' do node.js Obs o intuito deste projeto não é o fronten

Vinicius dos Santos Rodrigues 4 Jul 14, 2022
Lightweight WebSocket lib with socket.io-like event handling, requests, and channels

ws-wrapper Lightweight and isomorphic Web Socket lib with socket.io-like event handling, Promise-based requests, and channels. What? Much like Socket.

Blake Miner 70 Dec 23, 2022
The cutest little WebSocket wrapper! 🧦

Sockette The cutest little WebSocket wrapper! ?? Sockette is a tiny (367 bytes) wrapper around WebSocket that will automatically reconnect if the conn

Luke Edwards 2.4k Jan 2, 2023
A Develop Tool to Test WebSocket, Socket.IO, Stomp, Bayeux, HTTP, TCP, UDP, WebRTC, DNS API.

A Develop Tool to Test WebSocket, Socket.IO, Stomp, Bayeux, HTTP, TCP, UDP, WebRTC, DNS API.

York Yao 24 Sep 6, 2022
WebSocket cat

WebSocket cat

WebSockets 1.6k Jan 2, 2023
How to build a chat using Lambda + WebSocket + API Gateway? (nodejs)

Description Source code for the lambda function from the screencast How to build a chat using Lambda + WebSocket + API Gateway? (nodejs) The reactjs c

Alex 21 Dec 28, 2022
A tiny Nuxt.js module for WebSocket interactions

@deepsource/nuxt-websocket A tiny Nuxt.js module for WebSocket interactions. This module is only compatible with Nuxt v2 at the moment. Setup Add @dee

DeepSource 23 Dec 6, 2022
A websocket-based reverse shell for XSS attacks.

CrossSiteShell A javascript/nodejs "reverse shell" that makes it easier to interact with the victim's browser during XSS attacks. Usage Run the follow

Rafael 13 Oct 7, 2022
Um bot feito utilizando a API baileys em WebSocket para o Whatsapp Multi-Devices.

Informação ?? O BaileysBot foi feito utilzando a API Baileys Caso encontre algum BUG, faça um Novo Issue! Requisitos ?? NodeJS Git Instalação ?? Para

null 12 Dec 3, 2022
Sse-example - SSE (server-sent events) example using Node.js

sse-example SSE (server-sent events) example using Node.js SSE is a easy way to commutate with the client side in a single direction. it has loss cost

Jack 2 Mar 11, 2022
Super-Resolution-CNN - web server for super-resolution CNN

Web Server for Image Super-Resolution This project showcases the Super-Resolution CNN (SRCNN). The model is pretrained following this tutorial. The or

Daniel O'Sullivan 1 Jan 3, 2022
soketi is your simple, fast, and resilient open-source WebSockets server

soketi soketi is your simple, fast, and resilient open-source WebSockets server. ?? Blazing fast speed ⚡ The server is built on top of uWebSockets.js

Soketi 3.2k Jan 4, 2023
This server is made to serve the MSN-Messenger app develop by Gabriel Godoy. This applications is capable to register users and messages in order implements a real time chat.

?? MSN-Messenger-Server Node.js server for real time chat About | Installations | How to Use | Documentation | Technologies | License ?? About This se

Guilherme Feitosa 7 Dec 20, 2022
🚀🚀🚀 Nuxt3 client and server communication

Nuxt 3 Minimal Starter Look at the nuxt 3 documentation to learn more. Setup Make sure to install the dependencies: # yarn yarn install # npm npm ins

HomWang 4 Dec 19, 2022
μWebSockets for Node.js back-ends :metal:

Simple, secure[1] & standards compliant[2] web server for the most demanding[3] of applications. Read more... A note on NPM drama ⚡ Simple performance

uNetworking AB 5.7k Jan 8, 2023