github.com Open in urlscan Pro
140.82.121.4  Public Scan

Submitted URL: http://sockjs.org/
Effective URL: https://github.com/sockjs/sockjs-client
Submission: On December 08 via manual from US — Scanned from DE

Form analysis 1 forms found in the DOM

GET /sockjs/sockjs-client/search

<form class="js-site-search-form" role="search" aria-label="Site" data-scope-type="Repository" data-scope-id="2088939" data-scoped-search-url="/sockjs/sockjs-client/search" data-owner-scoped-search-url="/orgs/sockjs/search"
  data-unscoped-search-url="/search" action="/sockjs/sockjs-client/search" accept-charset="UTF-8" method="get">
  <label class="form-control input-sm header-search-wrapper p-0 js-chromeless-input-container header-search-wrapper-jump-to position-relative d-flex flex-justify-between flex-items-center">
    <input type="text" class="form-control input-sm header-search-input jump-to-field js-jump-to-field js-site-search-focus js-site-search-field is-clearable" data-hotkey="s,/" name="q" data-test-selector="nav-search-input" placeholder="Search"
      data-unscoped-placeholder="Search GitHub" data-scoped-placeholder="Search" autocapitalize="off" role="combobox" aria-haspopup="listbox" aria-expanded="false" aria-autocomplete="list" aria-controls="jump-to-results" aria-label="Search"
      data-jump-to-suggestions-path="/_graphql/GetSuggestedNavigationDestinations" spellcheck="false" autocomplete="off">
    <input type="hidden" data-csrf="true" class="js-data-jump-to-suggestions-path-csrf" value="IBiFBKrgqbMD+FYjMkclxHhYrlXzjSOfzRE7/PmZlKGwjcbHZaOo9gOhM8tCDAs3kalK7M1wcLIfjNVy26dAMg==">
    <input type="hidden" class="js-site-search-type-field" name="type">
    <svg xmlns="http://www.w3.org/2000/svg" width="22" height="20" aria-hidden="true" class="mr-1 header-search-key-slash">
      <path fill="none" stroke="#979A9C" opacity=".4" d="M3.5.5h12c1.7 0 3 1.3 3 3v13c0 1.7-1.3 3-3 3h-12c-1.7 0-3-1.3-3-3v-13c0-1.7 1.3-3 3-3z"></path>
      <path fill="#979A9C" d="M11.8 6L8 15.1h-.9L10.8 6h1z"></path>
    </svg>
    <div class="Box position-absolute overflow-hidden d-none jump-to-suggestions js-jump-to-suggestions-container">
      <ul class="d-none js-jump-to-suggestions-template-container">
        <li class="d-flex flex-justify-start flex-items-center p-0 f5 navigation-item js-navigation-item js-jump-to-suggestion" role="option">
          <a tabindex="-1" class="no-underline d-flex flex-auto flex-items-center jump-to-suggestions-path js-jump-to-suggestion-path js-navigation-open p-2" href="" data-item-type="suggestion">
    <div class="jump-to-octicon js-jump-to-octicon flex-shrink-0 mr-2 text-center d-none">
      <svg title="Repository" aria-label="Repository" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo js-jump-to-octicon-repo d-none flex-shrink-0">
    <path fill-rule="evenodd" d="M2 2.5A2.5 2.5 0 014.5 0h8.75a.75.75 0 01.75.75v12.5a.75.75 0 01-.75.75h-2.5a.75.75 0 110-1.5h1.75v-2h-8a1 1 0 00-.714 1.7.75.75 0 01-1.072 1.05A2.495 2.495 0 012 11.5v-9zm10.5-1V9h-8c-.356 0-.694.074-1 .208V2.5a1 1 0 011-1h8zM5 12.25v3.25a.25.25 0 00.4.2l1.45-1.087a.25.25 0 01.3 0L8.6 15.7a.25.25 0 00.4-.2v-3.25a.25.25 0 00-.25-.25h-3.5a.25.25 0 00-.25.25z"></path>
</svg>
      <svg title="Project" aria-label="Project" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-project js-jump-to-octicon-project d-none flex-shrink-0">
    <path fill-rule="evenodd" d="M1.75 0A1.75 1.75 0 000 1.75v12.5C0 15.216.784 16 1.75 16h12.5A1.75 1.75 0 0016 14.25V1.75A1.75 1.75 0 0014.25 0H1.75zM1.5 1.75a.25.25 0 01.25-.25h12.5a.25.25 0 01.25.25v12.5a.25.25 0 01-.25.25H1.75a.25.25 0 01-.25-.25V1.75zM11.75 3a.75.75 0 00-.75.75v7.5a.75.75 0 001.5 0v-7.5a.75.75 0 00-.75-.75zm-8.25.75a.75.75 0 011.5 0v5.5a.75.75 0 01-1.5 0v-5.5zM8 3a.75.75 0 00-.75.75v3.5a.75.75 0 001.5 0v-3.5A.75.75 0 008 3z"></path>
</svg>
      <svg title="Search" aria-label="Search" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-search js-jump-to-octicon-search d-none flex-shrink-0">
    <path fill-rule="evenodd" d="M11.5 7a4.499 4.499 0 11-8.998 0A4.499 4.499 0 0111.5 7zm-.82 4.74a6 6 0 111.06-1.06l3.04 3.04a.75.75 0 11-1.06 1.06l-3.04-3.04z"></path>
</svg>
    </div>

    <img class="avatar mr-2 flex-shrink-0 js-jump-to-suggestion-avatar d-none" alt="" aria-label="Team" src="" width="28" height="28">

    <div class="jump-to-suggestion-name js-jump-to-suggestion-name flex-auto overflow-hidden text-left no-wrap css-truncate css-truncate-target">
    </div>

    <div class="border rounded-1 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none js-jump-to-badge-search">
      <span class="js-jump-to-badge-search-text-default d-none" aria-label="in this repository">
        In this repository
      </span>
      <span class="js-jump-to-badge-search-text-global d-none" aria-label="in all of GitHub">
        All GitHub
      </span>
      <span aria-hidden="true" class="d-inline-block ml-1 v-align-middle">↵</span>
    </div>

    <div aria-hidden="true" class="border rounded-1 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none d-on-nav-focus js-jump-to-badge-jump">
      Jump to
      <span class="d-inline-block ml-1 v-align-middle">↵</span>
    </div>
  </a>
        </li>
      </ul>
      <ul class="d-none js-jump-to-no-results-template-container">
        <li class="d-flex flex-justify-center flex-items-center f5 d-none js-jump-to-suggestion p-2">
          <span class="color-fg-muted">No suggested jump to results</span>
        </li>
      </ul>
      <ul id="jump-to-results" role="listbox" class="p-0 m-0 js-navigation-container jump-to-suggestions-results-container js-jump-to-suggestions-results-container">
        <li class="d-flex flex-justify-start flex-items-center p-0 f5 navigation-item js-navigation-item js-jump-to-scoped-search d-none" role="option">
          <a tabindex="-1" class="no-underline d-flex flex-auto flex-items-center jump-to-suggestions-path js-jump-to-suggestion-path js-navigation-open p-2" href="" data-item-type="scoped_search">
    <div class="jump-to-octicon js-jump-to-octicon flex-shrink-0 mr-2 text-center d-none">
      <svg title="Repository" aria-label="Repository" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo js-jump-to-octicon-repo d-none flex-shrink-0">
    <path fill-rule="evenodd" d="M2 2.5A2.5 2.5 0 014.5 0h8.75a.75.75 0 01.75.75v12.5a.75.75 0 01-.75.75h-2.5a.75.75 0 110-1.5h1.75v-2h-8a1 1 0 00-.714 1.7.75.75 0 01-1.072 1.05A2.495 2.495 0 012 11.5v-9zm10.5-1V9h-8c-.356 0-.694.074-1 .208V2.5a1 1 0 011-1h8zM5 12.25v3.25a.25.25 0 00.4.2l1.45-1.087a.25.25 0 01.3 0L8.6 15.7a.25.25 0 00.4-.2v-3.25a.25.25 0 00-.25-.25h-3.5a.25.25 0 00-.25.25z"></path>
</svg>
      <svg title="Project" aria-label="Project" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-project js-jump-to-octicon-project d-none flex-shrink-0">
    <path fill-rule="evenodd" d="M1.75 0A1.75 1.75 0 000 1.75v12.5C0 15.216.784 16 1.75 16h12.5A1.75 1.75 0 0016 14.25V1.75A1.75 1.75 0 0014.25 0H1.75zM1.5 1.75a.25.25 0 01.25-.25h12.5a.25.25 0 01.25.25v12.5a.25.25 0 01-.25.25H1.75a.25.25 0 01-.25-.25V1.75zM11.75 3a.75.75 0 00-.75.75v7.5a.75.75 0 001.5 0v-7.5a.75.75 0 00-.75-.75zm-8.25.75a.75.75 0 011.5 0v5.5a.75.75 0 01-1.5 0v-5.5zM8 3a.75.75 0 00-.75.75v3.5a.75.75 0 001.5 0v-3.5A.75.75 0 008 3z"></path>
</svg>
      <svg title="Search" aria-label="Search" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-search js-jump-to-octicon-search d-none flex-shrink-0">
    <path fill-rule="evenodd" d="M11.5 7a4.499 4.499 0 11-8.998 0A4.499 4.499 0 0111.5 7zm-.82 4.74a6 6 0 111.06-1.06l3.04 3.04a.75.75 0 11-1.06 1.06l-3.04-3.04z"></path>
</svg>
    </div>

    <img class="avatar mr-2 flex-shrink-0 js-jump-to-suggestion-avatar d-none" alt="" aria-label="Team" src="" width="28" height="28">

    <div class="jump-to-suggestion-name js-jump-to-suggestion-name flex-auto overflow-hidden text-left no-wrap css-truncate css-truncate-target">
    </div>

    <div class="border rounded-1 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none js-jump-to-badge-search">
      <span class="js-jump-to-badge-search-text-default d-none" aria-label="in this repository">
        In this repository
      </span>
      <span class="js-jump-to-badge-search-text-global d-none" aria-label="in all of GitHub">
        All GitHub
      </span>
      <span aria-hidden="true" class="d-inline-block ml-1 v-align-middle">↵</span>
    </div>

    <div aria-hidden="true" class="border rounded-1 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none d-on-nav-focus js-jump-to-badge-jump">
      Jump to
      <span class="d-inline-block ml-1 v-align-middle">↵</span>
    </div>
  </a>
        </li>
        <li class="d-flex flex-justify-start flex-items-center p-0 f5 navigation-item js-navigation-item js-jump-to-owner-scoped-search d-none" role="option">
          <a tabindex="-1" class="no-underline d-flex flex-auto flex-items-center jump-to-suggestions-path js-jump-to-suggestion-path js-navigation-open p-2" href="" data-item-type="owner_scoped_search">
    <div class="jump-to-octicon js-jump-to-octicon flex-shrink-0 mr-2 text-center d-none">
      <svg title="Repository" aria-label="Repository" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo js-jump-to-octicon-repo d-none flex-shrink-0">
    <path fill-rule="evenodd" d="M2 2.5A2.5 2.5 0 014.5 0h8.75a.75.75 0 01.75.75v12.5a.75.75 0 01-.75.75h-2.5a.75.75 0 110-1.5h1.75v-2h-8a1 1 0 00-.714 1.7.75.75 0 01-1.072 1.05A2.495 2.495 0 012 11.5v-9zm10.5-1V9h-8c-.356 0-.694.074-1 .208V2.5a1 1 0 011-1h8zM5 12.25v3.25a.25.25 0 00.4.2l1.45-1.087a.25.25 0 01.3 0L8.6 15.7a.25.25 0 00.4-.2v-3.25a.25.25 0 00-.25-.25h-3.5a.25.25 0 00-.25.25z"></path>
</svg>
      <svg title="Project" aria-label="Project" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-project js-jump-to-octicon-project d-none flex-shrink-0">
    <path fill-rule="evenodd" d="M1.75 0A1.75 1.75 0 000 1.75v12.5C0 15.216.784 16 1.75 16h12.5A1.75 1.75 0 0016 14.25V1.75A1.75 1.75 0 0014.25 0H1.75zM1.5 1.75a.25.25 0 01.25-.25h12.5a.25.25 0 01.25.25v12.5a.25.25 0 01-.25.25H1.75a.25.25 0 01-.25-.25V1.75zM11.75 3a.75.75 0 00-.75.75v7.5a.75.75 0 001.5 0v-7.5a.75.75 0 00-.75-.75zm-8.25.75a.75.75 0 011.5 0v5.5a.75.75 0 01-1.5 0v-5.5zM8 3a.75.75 0 00-.75.75v3.5a.75.75 0 001.5 0v-3.5A.75.75 0 008 3z"></path>
</svg>
      <svg title="Search" aria-label="Search" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-search js-jump-to-octicon-search d-none flex-shrink-0">
    <path fill-rule="evenodd" d="M11.5 7a4.499 4.499 0 11-8.998 0A4.499 4.499 0 0111.5 7zm-.82 4.74a6 6 0 111.06-1.06l3.04 3.04a.75.75 0 11-1.06 1.06l-3.04-3.04z"></path>
</svg>
    </div>

    <img class="avatar mr-2 flex-shrink-0 js-jump-to-suggestion-avatar d-none" alt="" aria-label="Team" src="" width="28" height="28">

    <div class="jump-to-suggestion-name js-jump-to-suggestion-name flex-auto overflow-hidden text-left no-wrap css-truncate css-truncate-target">
    </div>

    <div class="border rounded-1 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none js-jump-to-badge-search">
      <span class="js-jump-to-badge-search-text-default d-none" aria-label="in this organization">
        In this organization
      </span>
      <span class="js-jump-to-badge-search-text-global d-none" aria-label="in all of GitHub">
        All GitHub
      </span>
      <span aria-hidden="true" class="d-inline-block ml-1 v-align-middle">↵</span>
    </div>

    <div aria-hidden="true" class="border rounded-1 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none d-on-nav-focus js-jump-to-badge-jump">
      Jump to
      <span class="d-inline-block ml-1 v-align-middle">↵</span>
    </div>
  </a>
        </li>
        <li class="d-flex flex-justify-start flex-items-center p-0 f5 navigation-item js-navigation-item js-jump-to-global-search d-none" role="option">
          <a tabindex="-1" class="no-underline d-flex flex-auto flex-items-center jump-to-suggestions-path js-jump-to-suggestion-path js-navigation-open p-2" href="" data-item-type="global_search">
    <div class="jump-to-octicon js-jump-to-octicon flex-shrink-0 mr-2 text-center d-none">
      <svg title="Repository" aria-label="Repository" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo js-jump-to-octicon-repo d-none flex-shrink-0">
    <path fill-rule="evenodd" d="M2 2.5A2.5 2.5 0 014.5 0h8.75a.75.75 0 01.75.75v12.5a.75.75 0 01-.75.75h-2.5a.75.75 0 110-1.5h1.75v-2h-8a1 1 0 00-.714 1.7.75.75 0 01-1.072 1.05A2.495 2.495 0 012 11.5v-9zm10.5-1V9h-8c-.356 0-.694.074-1 .208V2.5a1 1 0 011-1h8zM5 12.25v3.25a.25.25 0 00.4.2l1.45-1.087a.25.25 0 01.3 0L8.6 15.7a.25.25 0 00.4-.2v-3.25a.25.25 0 00-.25-.25h-3.5a.25.25 0 00-.25.25z"></path>
</svg>
      <svg title="Project" aria-label="Project" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-project js-jump-to-octicon-project d-none flex-shrink-0">
    <path fill-rule="evenodd" d="M1.75 0A1.75 1.75 0 000 1.75v12.5C0 15.216.784 16 1.75 16h12.5A1.75 1.75 0 0016 14.25V1.75A1.75 1.75 0 0014.25 0H1.75zM1.5 1.75a.25.25 0 01.25-.25h12.5a.25.25 0 01.25.25v12.5a.25.25 0 01-.25.25H1.75a.25.25 0 01-.25-.25V1.75zM11.75 3a.75.75 0 00-.75.75v7.5a.75.75 0 001.5 0v-7.5a.75.75 0 00-.75-.75zm-8.25.75a.75.75 0 011.5 0v5.5a.75.75 0 01-1.5 0v-5.5zM8 3a.75.75 0 00-.75.75v3.5a.75.75 0 001.5 0v-3.5A.75.75 0 008 3z"></path>
</svg>
      <svg title="Search" aria-label="Search" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-search js-jump-to-octicon-search d-none flex-shrink-0">
    <path fill-rule="evenodd" d="M11.5 7a4.499 4.499 0 11-8.998 0A4.499 4.499 0 0111.5 7zm-.82 4.74a6 6 0 111.06-1.06l3.04 3.04a.75.75 0 11-1.06 1.06l-3.04-3.04z"></path>
</svg>
    </div>

    <img class="avatar mr-2 flex-shrink-0 js-jump-to-suggestion-avatar d-none" alt="" aria-label="Team" src="" width="28" height="28">

    <div class="jump-to-suggestion-name js-jump-to-suggestion-name flex-auto overflow-hidden text-left no-wrap css-truncate css-truncate-target">
    </div>

    <div class="border rounded-1 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none js-jump-to-badge-search">
      <span class="js-jump-to-badge-search-text-default d-none" aria-label="in this repository">
        In this repository
      </span>
      <span class="js-jump-to-badge-search-text-global d-none" aria-label="in all of GitHub">
        All GitHub
      </span>
      <span aria-hidden="true" class="d-inline-block ml-1 v-align-middle">↵</span>
    </div>

    <div aria-hidden="true" class="border rounded-1 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none d-on-nav-focus js-jump-to-badge-jump">
      Jump to
      <span class="d-inline-block ml-1 v-align-middle">↵</span>
    </div>
  </a>
        </li>
      </ul>
    </div>
  </label>
</form>

Text Content

Skip to content
Sign up
 * Why GitHub?
    * Features →
    * Mobile →
    * Actions →
    * Codespaces →
    * Packages →
    * Security →
    * Code review →
    * Issues →
    * Integrations →
    * GitHub Sponsors →
    * Customer stories →

 * Team
 * Enterprise
 * Explore
    * Explore GitHub →
    * Learn and contribute
    * Topics →
    * Collections →
    * Trending →
    * Learning Lab →
    * Open source guides →
    * Connect with others
    * The ReadME Project →
    * Events →
    * Community forum →
    * GitHub Education →
    * GitHub Stars program →

 * Marketplace
 * Pricing
    * Plans →
    * Compare plans →
    * Contact Sales →
    * Education →

 * In this repository All GitHub ↵
   Jump to ↵

 * No suggested jump to results

 * In this repository All GitHub ↵
   Jump to ↵
 * In this organization All GitHub ↵
   Jump to ↵
 * In this repository All GitHub ↵
   Jump to ↵

Sign in
Sign up

{{ message }}


SOCKJS / SOCKJS-CLIENT PUBLIC

 * Sponsor
   
   
   SPONSOR SOCKJS/SOCKJS-CLIENT
   
   Loading
 * Notifications
 * Star 7.8k
 * Fork 1.3k
 * 

WebSocket emulation - Javascript client

sockjs.org
MIT License
7.8k stars 1.3k forks
Star
Notifications
 * Code
 * Issues 4
 * Pull requests 6
 * Discussions
 * Actions
 * Wiki
 * Security
 * Insights

More
 * Code
 * Issues
 * Pull requests
 * Discussions
 * Actions
 * Wiki
 * Security
 * Insights

main
Switch branches/tags

Branches Tags
Could not load branches
Nothing to show
Loading
{{ refName }} default
View all branches
Could not load tags
Nothing to show
{{ refName }} default
Loading
View all tags
6 branches 43 tags

Go to file Code
 * Clone
   HTTPS GitHub CLI
   
   Use Git or checkout with SVN using the web URL.
   
   Work fast with our official CLI. Learn more.

 * Open with GitHub Desktop
 * Download ZIP

LAUNCHING GITHUB DESKTOP

If nothing happens, download GitHub Desktop and try again.

LAUNCHING GITHUB DESKTOP

If nothing happens, download GitHub Desktop and try again.

LAUNCHING XCODE

If nothing happens, download Xcode and try again.

LAUNCHING VISUAL STUDIO CODE

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.


LATEST COMMIT

brycekahle Update package-lock.json
…
e563829 on Sep 23
Update package-lock.json
e563829


GIT STATS

 * 946 commits


FILES

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
.github
Create stale.yml
16 months ago
dist
1.5.2
4 months ago
img
Add browserstack logo to README
3 years ago
lib
Remove JSON3
3 months ago
tests
Remove JSON3
3 months ago
.eslintignore
Change to plain eslint from gulp-eslint. Remove jshint.
5 years ago
.eslintrc
Change to plain eslint from gulp-eslint. Remove jshint.
5 years ago
.gitignore
Update dev deps to fix security issues
2 years ago
.jscsrc
code style
7 years ago
.npmignore
Remove references to travis
3 months ago
.nvmrc
Update mocha
3 months ago
AUTHORS
Add AUTHORS file
3 years ago
CODE_OF_CONDUCT.md
Create CODE_OF_CONDUCT.md
2 years ago
Changelog.md
1.5.2
4 months ago
LICENSE
Add AUTHORS file
3 years ago
README.md
Remove references to travis
3 months ago
build.sh
Remove references to travis
3 months ago
gulpfile.js
Update build dependencies
3 years ago
karma.conf.js
Add support for a manual testing server
3 years ago
package-lock.json
Update package-lock.json
3 months ago
package.json
Remove JSON3
3 months ago
View code
SockJS-client SockJS for enterprise Summary SockJS family Getting Started
SockJS-client API SockJS class Supported transports, by browser (html served
from http:// or https://) Supported transports, by browser (html served from
file://) Supported transports, by name Connecting to SockJS without the client
Deployment Development and testing Testing Browser Quirks


README.MD




SOCKJS-CLIENT




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.


SUMMARY

SockJS is a browser JavaScript library 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.

Under the hood SockJS tries to use native WebSockets first. If that fails it can
use a variety of browser-specific transport protocols and presents them through
WebSocket-like abstractions.

SockJS is intended to work for all modern browsers and in environments which
don't support the WebSocket protocol -- for example, behind restrictive
corporate proxies.

SockJS-client does require a server counterpart:

 * SockJS-node is a SockJS server for Node.js.

Philosophy:

 * The API should follow HTML5 Websockets API as closely as possible.
 * All the transports must support cross domain connections out of the box. It's
   possible and recommended to host a SockJS server on a different server than
   your main web site.
 * There is support for at least one streaming protocol for every major browser.
 * Streaming transports should work cross-domain and should support cookies (for
   cookie-based sticky sessions).
 * Polling transports are used as a fallback for old browsers and hosts behind
   restrictive proxies.
 * Connection establishment should be fast and lightweight.
 * No Flash inside (no need to open port 843 - which doesn't work through
   proxies, no need to host 'crossdomain.xml', no need to wait for 3 seconds in
   order to detect problems)

Subscribe to SockJS mailing list for discussions and support.


SOCKJS FAMILY

 * SockJS-client JavaScript client library
 * SockJS-node Node.js server
 * SockJS-erlang Erlang server
 * SockJS-cyclone Python/Cyclone/Twisted server
 * SockJS-tornado Python/Tornado server
 * SockJS-twisted Python/Twisted server
 * SockJS-aiohttp Python/Aiohttp server
 * Spring Framework Java client & server
 * vert.x Java/vert.x server
 * Xitrum Scala server
 * Atmosphere Framework JavaEE Server, Play Framework, Netty, Vert.x
 * Actix SockJS Rust Server, Actix Framework

Work in progress:

 * SockJS-ruby
 * SockJS-netty
 * SockJS-gevent (SockJS-gevent fork)
 * pyramid-SockJS
 * wildcloud-websockets
 * wai-SockJS
 * SockJS-perl
 * SockJS-go
 * syp.biz.SockJS.NET - .NET port of the SockJS client


GETTING STARTED

SockJS mimics the WebSockets API, but instead of WebSocket there is a SockJS
Javascript object.

First, you need to load the SockJS JavaScript library. For example, you can put
that in your HTML head:

<script src="https://cdn.jsdelivr.net/npm/sockjs-client@1/dist/sockjs.min.js"></script>



After the script is loaded you can establish a connection with the SockJS
server. Here's a simple example:

 var sock = new SockJS('https://mydomain.com/my_prefix');
 sock.onopen = function() {
     console.log('open');
     sock.send('test');
 };

 sock.onmessage = function(e) {
     console.log('message', e.data);
     sock.close();
 };

 sock.onclose = function() {
     console.log('close');
 };




SOCKJS-CLIENT API


SOCKJS CLASS

Similar to the 'WebSocket' API, the 'SockJS' constructor takes one, or more
arguments:

var sockjs = new SockJS(url, _reserved, options);



url may contain a query string, if one is desired.

Where options is a hash which can contain:

 * server (string)
   
   String to append to url for actual data connection. Defaults to a random 4
   digit number.

 * transports (string OR array of strings)
   
   Sometimes it is useful to disable some fallback transports. This option
   allows you to supply a list transports that may be used by SockJS. By default
   all available transports will be used.

 * sessionId (number OR function)
   
   Both client and server use session identifiers to distinguish connections. If
   you specify this option as a number, SockJS will use its random string
   generator function to generate session ids that are N-character long (where N
   corresponds to the number specified by sessionId). When you specify this
   option as a function, the function must return a randomly generated string.
   Every time SockJS needs to generate a session id it will call this function
   and use the returned string directly. If you don't specify this option, the
   default is to use the default random string generator to generate 8-character
   long session ids.

 * timeout (number)
   
   Specify a minimum timeout in milliseconds to use for the transport
   connections. By default this is dynamically calculated based on the measured
   RTT and the number of expected round trips. This setting will establish a
   minimum, but if the calculated timeout is higher, that will be used.

Although the 'SockJS' object tries to emulate the 'WebSocket' behaviour, it's
impossible to support all of its features. An important SockJS limitation is the
fact that you're not allowed to open more than one SockJS connection to a single
domain at a time. This limitation is caused by an in-browser limit of outgoing
connections - usually browsers don't allow opening more than two outgoing
connections to a single domain. A single SockJS session requires those two
connections - one for downloading data, the other for sending messages. Opening
a second SockJS session at the same time would most likely block, and can result
in both sessions timing out.

Opening more than one SockJS connection at a time is generally a bad practice.
If you absolutely must do it, you can use multiple subdomains, using a different
subdomain for every SockJS connection.


SUPPORTED TRANSPORTS, BY BROWSER (HTML SERVED FROM HTTP:// OR HTTPS://)

Browser Websockets Streaming Polling IE 6, 7 no no jsonp-polling IE 8, 9
(cookies=no) no xdr-streaming † xdr-polling † IE 8, 9 (cookies=yes) no
iframe-htmlfile iframe-xhr-polling IE 10 rfc6455 xhr-streaming xhr-polling
Chrome 6-13 hixie-76 xhr-streaming xhr-polling Chrome 14+ hybi-10 / rfc6455
xhr-streaming xhr-polling Firefox <10 no ‡ xhr-streaming xhr-polling Firefox 10+
hybi-10 / rfc6455 xhr-streaming xhr-polling Safari 5.x hixie-76 xhr-streaming
xhr-polling Safari 6+ rfc6455 xhr-streaming xhr-polling Opera 10.70+ no ‡
iframe-eventsource iframe-xhr-polling Opera 12.10+ rfc6455 xhr-streaming
xhr-polling Konqueror no no jsonp-polling

 * †: IE 8+ supports [XDomainRequest]1, which is essentially a modified AJAX/XHR
   that can do requests across domains. But unfortunately it doesn't send any
   cookies, which makes it inappropriate for deployments when the load balancer
   uses JSESSIONID cookie to do sticky sessions.

 * ‡: Firefox 4.0 and Opera 11.00 and shipped with disabled Websockets
   "hixie-76". They can still be enabled by manually changing a browser setting.


SUPPORTED TRANSPORTS, BY BROWSER (HTML SERVED FROM FILE://)

Sometimes you may want to serve your html from "file://" address - for
development or if you're using PhoneGap or similar technologies. But due to the
Cross Origin Policy files served from "file://" have no Origin, and that means
some of SockJS transports won't work. For this reason the SockJS transport table
is different than usually, major differences are:

Browser Websockets Streaming Polling IE 8, 9 same as above iframe-htmlfile
iframe-xhr-polling Other same as above iframe-eventsource iframe-xhr-polling


SUPPORTED TRANSPORTS, BY NAME

Transport References websocket (rfc6455) [rfc 6455]2 websocket (hixie-76)
[draft-hixie-thewebsocketprotocol-76]3 websocket (hybi-10)
[draft-ietf-hybi-thewebsocketprotocol-10]4 xhr-streaming Transport using [Cross
domain XHR]5 [streaming]6 capability (readyState=3). xdr-streaming Transport
using [XDomainRequest]1 [streaming]6 capability (readyState=3). eventsource
[EventSource/Server-sent events]7. iframe-eventsource [EventSource/Server-sent
events]7 used from an [iframe via postMessage]8. htmlfile [HtmlFile]9.
iframe-htmlfile [HtmlFile]9 used from an [iframe via postMessage]8. xhr-polling
Long-polling using [cross domain XHR]5. xdr-polling Long-polling using
[XDomainRequest]1. iframe-xhr-polling Long-polling using normal AJAX from an
[iframe via postMessage]8. jsonp-polling Slow and old fashioned [JSONP
polling]10. This transport will show "busy indicator" (aka: "spinning wheel")
when sending data.


CONNECTING TO SOCKJS WITHOUT THE CLIENT

Although the main point of SockJS is 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).


DEPLOYMENT

You should use a version of sockjs-client that supports the protocol used by
your server. For example:

<script src="https://cdn.jsdelivr.net/npm/sockjs-client@1/dist/sockjs.min.js"></script>



For server-side deployment tricks, especially about load balancing and session
stickiness, take a look at the SockJS-node readme.


DEVELOPMENT AND TESTING

SockJS-client needs node.js for running a test server and JavaScript
minification. If you want to work on SockJS-client source code, checkout the git
repo and follow these steps:

cd sockjs-client
npm install




To generate JavaScript, run:

gulp browserify




To generate minified JavaScript, run:

gulp browserify:min




Both commands output into the build directory.


TESTING

Automated testing provided by:



Once you've compiled the SockJS-client you may want to check if your changes
pass all the tests.

npm run test:browser_local




This will start karma and a test support server.


BROWSER QUIRKS

There are various browser quirks which we don't intend to address:

 * Pressing ESC in Firefox, before Firefox 20, closes the SockJS connection. For
   a workaround and discussion see #18.
 * jsonp-polling transport will show a "spinning wheel" (aka. "busy indicator")
   when sending data.
 * You can't open more than one SockJS connection to one domain at the same time
   due to the browser's limit of concurrent connections (this limit is not
   counting native WebSocket connections).
 * Although SockJS is trying to escape any strange Unicode characters (even
   invalid ones - like surrogates \xD800-\xDBFF or \xFFFE and \xFFFF) it's
   advisable to use only valid characters. Using invalid characters is a bit
   slower, and may not work with SockJS servers that have proper Unicode
   support.
 * Having a global function called onmessage or such is probably a bad idea, as
   it could be called by the built-in postMessage API.
 * From SockJS' point of view there is nothing special about SSL/HTTPS.
   Connecting between unencrypted and encrypted sites should work just fine.
 * Although SockJS does its best to support both prefix and cookie based sticky
   sessions, the latter may not work well cross-domain with browsers that don't
   accept third-party cookies by default (Safari). In order to get around this
   make sure you're connecting to SockJS from the same parent domain as the main
   site. For example 'sockjs.a.com' is able to set cookies if you're connecting
   from 'www.a.com' or 'a.com'.
 * Trying to connect from secure "https://" to insecure "http://" is not a good
   idea. The other way around should be fine.
 * Long polling is known to cause problems on Heroku, but a workaround for
   SockJS is available.
 * SockJS websocket transport is more stable over SSL. If you're a serious
   SockJS user then consider using SSL (more info).


FOOTNOTES

 1.  https://blogs.msdn.microsoft.com/ieinternals/2010/05/13/xdomainrequest-restrictions-limitations-and-workarounds/
     ↩ ↩2 ↩3

 2.  https://www.rfc-editor.org/rfc/rfc6455.txt ↩

 3.  https://tools.ietf.org/html/draft-hixie-thewebsocketprotocol-76 ↩

 4.  https://tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-10 ↩

 5.  https://secure.wikimedia.org/wikipedia/en/wiki/XMLHttpRequest#Cross-domain_requests
     ↩ ↩2

 6.  http://www.debugtheweb.com/test/teststreaming.aspx ↩ ↩2

 7.  https://html.spec.whatwg.org/multipage/comms.html#server-sent-events ↩ ↩2

 8.  https://developer.mozilla.org/en/DOM/window.postMessage ↩ ↩2 ↩3

 9.  http://cometdaily.com/2007/11/18/ie-activexhtmlfile-transport-part-ii/ ↩ ↩2

 10. https://secure.wikimedia.org/wikipedia/en/wiki/JSONP ↩


ABOUT

WebSocket emulation - Javascript client

sockjs.org


TOPICS

javascript real-time websocket sockjs


RESOURCES

Readme


LICENSE

MIT License


CODE OF CONDUCT

Code of conduct


RELEASES 16

1.5.2 Latest
on Aug 24
+ 15 releases


SPONSOR THIS PROJECT

 * tidelift.com/funding/github/npm/sockjs-client


PACKAGES 0

No packages published



USED BY 5.7M

 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 

+ 5,723,446


CONTRIBUTORS 50

 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 

+ 39 contributors


LANGUAGES


 * JavaScript 90.5%
 * HTML 9.5%

 * © 2021 GitHub, Inc.
 * Terms
 * Privacy
 * Security
 * Status
 * Docs

 * Contact GitHub
 * Pricing
 * API
 * Training
 * Blog
 * About


You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You
signed out in another tab or window. Reload to refresh your session.