\href{https://www.npmjs.com/package/sockjs-client}{\texttt{ }}\href{https://travis-ci.org/sockjs/sockjs-client}{\texttt{ }}\href{https://david-dm.org/sockjs/sockjs-client}{\texttt{ }}\href{https://gitter.im/sockjs/sockjs-client}{\texttt{ }} \href{https://www.browserstack.com/automate/public-build/dW9YdlFsSEI5VzNBVVk5ZS9XT0xaTjJVQkhQMkRkNlZBQURiSWNWMC9jaz0tLXRJM05RbW1tTCt5TlhHaVgycFJUYmc9PQ==--e3ef9b9a9fa071084e6d87874b5fc65b71273821}{\texttt{ }}\hypertarget{md_sfcode_node_modules_sockjs_client_README_autotoc_md28097}{}\doxysection{Supporting Sock\+JS}\label{md_sfcode_node_modules_sockjs_client_README_autotoc_md28097}
Tidelift gives software development teams a single source for purchasing and maintaining their software, with professional grade assurances from the experts who know it best, while seamlessly integrating with existing tools.

\href{https://tidelift.com/subscription/pkg/npm-sockjs-client?utm_source=npm-sockjs-client&utm_medium=referral&utm_campaign=readme}{\texttt{ Get supported sockjs-\/client with the Tidelift Subscription}}\hypertarget{md_sfcode_node_modules_sockjs_client_README_autotoc_md28098}{}\doxysection{Summary}\label{md_sfcode_node_modules_sockjs_client_README_autotoc_md28098}
Sock\+JS is a browser Java\+Script library that provides a Web\+Socket-\/like object. Sock\+JS 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 Sock\+JS tries to use native Web\+Sockets first. If that fails it can use a variety of browser-\/specific transport protocols and presents them through Web\+Socket-\/like abstractions.

Sock\+JS is intended to work for all modern browsers and in environments which don\textquotesingle{}t support the Web\+Socket protocol -- for example, behind restrictive corporate proxies.

Sock\+JS-\/client does require a server counterpart\+:


\begin{DoxyItemize}
\item \href{https://github.com/sockjs/sockjs-node}{\texttt{ Sock\+JS-\/node}} is a Sock\+JS server for Node.\+js.
\end{DoxyItemize}

Philosophy\+:


\begin{DoxyItemize}
\item The API should follow \href{https://www.w3.org/TR/websockets/}{\texttt{ HTML5 Websockets API}} as closely as possible.
\item All the transports must support cross domain connections out of the box. It\textquotesingle{}s possible and recommended to host a Sock\+JS server on a different server than your main web site.
\item There is support for at least one streaming protocol for every major browser.
\item Streaming transports should work cross-\/domain and should support cookies (for cookie-\/based sticky sessions).
\item Polling transports are used as a fallback for old browsers and hosts behind restrictive proxies.
\item Connection establishment should be fast and lightweight.
\item No Flash inside (no need to open port 843 -\/ which doesn\textquotesingle{}t work through proxies, no need to host \textquotesingle{}crossdomain.\+xml\textquotesingle{}, no need \href{https://github.com/gimite/web-socket-js/issues/49}{\texttt{ to wait for 3 seconds}} in order to detect problems)
\end{DoxyItemize}

Subscribe to \href{https://groups.google.com/forum/\#!forum/sockjs}{\texttt{ Sock\+JS mailing list}} for discussions and support.\hypertarget{md_sfcode_node_modules_sockjs_client_README_autotoc_md28099}{}\doxysection{Sock\+JS family}\label{md_sfcode_node_modules_sockjs_client_README_autotoc_md28099}

\begin{DoxyItemize}
\item \href{https://github.com/sockjs/sockjs-client}{\texttt{ Sock\+JS-\/client}} Java\+Script client library
\item \href{https://github.com/sockjs/sockjs-node}{\texttt{ Sock\+JS-\/node}} Node.\+js server
\item \href{https://github.com/sockjs/sockjs-erlang}{\texttt{ Sock\+JS-\/erlang}} Erlang server
\item \href{https://github.com/flaviogrossi/sockjs-cyclone}{\texttt{ Sock\+JS-\/cyclone}} Python/\+Cyclone/\+Twisted server
\item \href{https://github.com/MrJoes/sockjs-tornado}{\texttt{ Sock\+JS-\/tornado}} Python/\+Tornado server
\item \href{https://github.com/DesertBus/sockjs-twisted/}{\texttt{ Sock\+JS-\/twisted}} Python/\+Twisted server
\item \href{https://github.com/aio-libs/sockjs/}{\texttt{ Sock\+JS-\/aiohttp}} Python/\+Aiohttp server
\item \href{https://projects.spring.io/spring-framework}{\texttt{ Spring Framework}} Java \href{https://docs.spring.io/spring-framework/docs/current/spring-framework-reference/web.html\#websocket-fallback-sockjs-client}{\texttt{ client}} \& server
\item \href{https://github.com/vert-x/vert.x}{\texttt{ vert.\+x}} Java/vert.\+x server
\item \href{https://xitrum-framework.github.io/}{\texttt{ Xitrum}} Scala server
\item \href{https://github.com/Atmosphere/atmosphere}{\texttt{ Atmosphere Framework}} Java\+EE Server, Play Framework, Netty, Vert.\+x
\item \href{https://github.com/fafhrd91/actix-sockjs}{\texttt{ Actix Sock\+JS}} Rust Server, Actix Framework
\end{DoxyItemize}

Work in progress\+:


\begin{DoxyItemize}
\item \href{https://github.com/nyarly/sockjs-ruby}{\texttt{ Sock\+JS-\/ruby}}
\item \href{https://github.com/cgbystrom/sockjs-netty}{\texttt{ Sock\+JS-\/netty}}
\item \href{https://github.com/ksava/sockjs-gevent}{\texttt{ Sock\+JS-\/gevent}} (\href{https://github.com/njoyce/sockjs-gevent}{\texttt{ Sock\+JS-\/gevent fork}})
\item \href{https://github.com/fafhrd91/pyramid_sockjs}{\texttt{ pyramid-\/\+Sock\+JS}}
\item \href{https://github.com/wildcloud/wildcloud-websockets}{\texttt{ wildcloud-\/websockets}}
\item \href{https://github.com/Palmik/wai-sockjs}{\texttt{ wai-\/\+Sock\+JS}}
\item \href{https://github.com/vti/sockjs-perl}{\texttt{ Sock\+JS-\/perl}}
\item \href{https://github.com/igm/sockjs-go/}{\texttt{ Sock\+JS-\/go}}
\item \href{https://github.com/sypbiz/SockJS.NET}{\texttt{ syp.\+biz.\+Sock\+JS.\+NET}} -\/ .NET port of the Sock\+JS client
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_sockjs_client_README_autotoc_md28100}{}\doxysection{Getting Started}\label{md_sfcode_node_modules_sockjs_client_README_autotoc_md28100}
Sock\+JS mimics the \href{https://www.w3.org/TR/websockets/}{\texttt{ Web\+Sockets API}}, but instead of {\ttfamily Web\+Socket} there is a {\ttfamily Sock\+JS} Javascript object.

First, you need to load the Sock\+JS Java\+Script library. For example, you can put that in your HTML head\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{<script src="{}https://cdn.jsdelivr.net/npm/sockjs-\/client@1/dist/sockjs.min.js"{}></script> }

\end{DoxyCode}


After the script is loaded you can establish a connection with the Sock\+JS server. Here\textquotesingle{}s a simple example\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{var sock = new SockJS('https://mydomain.com/my\_prefix');}
\DoxyCodeLine{sock.onopen = function() \{}
\DoxyCodeLine{    console.log('open');}
\DoxyCodeLine{    sock.send('test');}
\DoxyCodeLine{\};}
\DoxyCodeLine{}
\DoxyCodeLine{sock.onmessage = function(e) \{}
\DoxyCodeLine{    console.log('message', e.data);}
\DoxyCodeLine{    sock.close();}
\DoxyCodeLine{\};}
\DoxyCodeLine{}
\DoxyCodeLine{sock.onclose = function() \{}
\DoxyCodeLine{    console.log('close');}
\DoxyCodeLine{\};}

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_sockjs_client_README_autotoc_md28101}{}\doxysection{Sock\+JS-\/client API}\label{md_sfcode_node_modules_sockjs_client_README_autotoc_md28101}
\hypertarget{md_sfcode_node_modules_sockjs_client_README_autotoc_md28102}{}\doxysubsection{Sock\+JS class}\label{md_sfcode_node_modules_sockjs_client_README_autotoc_md28102}
Similar to the \textquotesingle{}Web\+Socket\textquotesingle{} API, the \textquotesingle{}Sock\+JS\textquotesingle{} constructor takes one, or more arguments\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{var sockjs = new SockJS(url, \_reserved, options); }

\end{DoxyCode}


{\ttfamily url} may contain a query string, if one is desired.

Where {\ttfamily options} is a hash which can contain\+:


\begin{DoxyItemize}
\item {\bfseries{server (string)}}

String to append to url for actual data connection. Defaults to a random 4 digit number.
\item {\bfseries{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 Sock\+JS. By default all available transports will be used.
\item {\bfseries{session\+Id (number OR function)}}

Both client and server use session identifiers to distinguish connections. If you specify this option as a number, Sock\+JS will use its random string generator function to generate session ids that are N-\/character long (where N corresponds to the number specified by {\bfseries{session\+Id}}). When you specify this option as a function, the function must return a randomly generated string. Every time Sock\+JS needs to generate a session id it will call this function and use the returned string directly. If you don\textquotesingle{}t specify this option, the default is to use the default random string generator to generate 8-\/character long session ids.
\begin{DoxyItemize}
\item {\bfseries{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.
\end{DoxyItemize}
\end{DoxyItemize}

Although the \textquotesingle{}Sock\+JS\textquotesingle{} object tries to emulate the \textquotesingle{}Web\+Socket\textquotesingle{} behaviour, it\textquotesingle{}s impossible to support all of its features. An important Sock\+JS limitation is the fact that you\textquotesingle{}re not allowed to open more than one Sock\+JS connection to a single domain at a time. This limitation is caused by an in-\/browser limit of outgoing connections -\/ usually \href{https://stackoverflow.com/questions/985431/max-parallel-http-connections-in-a-browser}{\texttt{ browsers don\textquotesingle{}t allow opening more than two outgoing connections to a single domain}}. A single Sock\+JS session requires those two connections -\/ one for downloading data, the other for sending messages. Opening a second Sock\+JS session at the same time would most likely block, and can result in both sessions timing out.

Opening more than one Sock\+JS 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 Sock\+JS connection.\hypertarget{md_sfcode_node_modules_sockjs_client_README_autotoc_md28103}{}\doxysection{Supported transports, by browser (html served from http\+:// or https\+://)}\label{md_sfcode_node_modules_sockjs_client_README_autotoc_md28103}
\tabulinesep=1mm
\begin{longtabu}spread 0pt [c]{*{4}{|X[-1]}|}
\hline
\PBS\centering \cellcolor{\tableheadbgcolor}\textbf{ {\itshape Browser}   }&\PBS\centering \cellcolor{\tableheadbgcolor}\textbf{ {\itshape Websockets}   }&\PBS\centering \cellcolor{\tableheadbgcolor}\textbf{ {\itshape Streaming}   }&\PBS\centering \cellcolor{\tableheadbgcolor}\textbf{ {\itshape Polling}    }\\\cline{1-4}
\endfirsthead
\hline
\endfoot
\hline
\PBS\centering \cellcolor{\tableheadbgcolor}\textbf{ {\itshape Browser}   }&\PBS\centering \cellcolor{\tableheadbgcolor}\textbf{ {\itshape Websockets}   }&\PBS\centering \cellcolor{\tableheadbgcolor}\textbf{ {\itshape Streaming}   }&\PBS\centering \cellcolor{\tableheadbgcolor}\textbf{ {\itshape Polling}    }\\\cline{1-4}
\endhead
IE 6, 7   &no   &no   &jsonp-\/polling    \\\cline{1-4}
IE 8, 9 (cookies=no)   &no   &xdr-\/streaming {$\dagger$}   &xdr-\/polling {$\dagger$}    \\\cline{1-4}
IE 8, 9 (cookies=yes)   &no   &iframe-\/htmlfile   &iframe-\/xhr-\/polling    \\\cline{1-4}
IE 10   &rfc6455   &xhr-\/streaming   &xhr-\/polling    \\\cline{1-4}
Chrome 6-\/13   &hixie-\/76   &xhr-\/streaming   &xhr-\/polling    \\\cline{1-4}
Chrome 14+   &hybi-\/10 / rfc6455   &xhr-\/streaming   &xhr-\/polling    \\\cline{1-4}
Firefox $<$10   &no {$\ddagger$}   &xhr-\/streaming   &xhr-\/polling    \\\cline{1-4}
Firefox 10+   &hybi-\/10 / rfc6455   &xhr-\/streaming   &xhr-\/polling    \\\cline{1-4}
Safari 5.\+x   &hixie-\/76   &xhr-\/streaming   &xhr-\/polling    \\\cline{1-4}
Safari 6+   &rfc6455   &xhr-\/streaming   &xhr-\/polling    \\\cline{1-4}
Opera 10.\+70+   &no {$\ddagger$}   &iframe-\/eventsource   &iframe-\/xhr-\/polling    \\\cline{1-4}
Opera 12.\+10+   &rfc6455   &xhr-\/streaming   &xhr-\/polling    \\\cline{1-4}
Konqueror   &no   &no   &jsonp-\/polling   \\\cline{1-4}
\end{longtabu}



\begin{DoxyItemize}
\item {\bfseries{{$\dagger$}}}\+: IE 8+ supports \href{https://blogs.msdn.microsoft.com/ieinternals/2010/05/13/xdomainrequest-restrictions-limitations-and-workarounds/}{\texttt{ XDomain\+Request}}, which is essentially a modified AJAX/\+XHR that can do requests across domains. But unfortunately it doesn\textquotesingle{}t send any cookies, which makes it inappropriate for deployments when the load balancer uses JSESSIONID cookie to do sticky sessions.
\item {\bfseries{{$\ddagger$}}}\+: Firefox 4.\+0 and Opera 11.\+00 and shipped with disabled Websockets \char`\"{}hixie-\/76\char`\"{}. They can still be enabled by manually changing a browser setting.
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_sockjs_client_README_autotoc_md28104}{}\doxysection{Supported transports, by browser (html served from file\+://)}\label{md_sfcode_node_modules_sockjs_client_README_autotoc_md28104}
Sometimes you may want to serve your html from \char`\"{}file\+://\char`\"{} address -\/ for development or if you\textquotesingle{}re using Phone\+Gap or similar technologies. But due to the Cross Origin Policy files served from \char`\"{}file\+://\char`\"{} have no Origin, and that means some of Sock\+JS transports won\textquotesingle{}t work. For this reason the Sock\+JS transport table is different than usually, major differences are\+:

\tabulinesep=1mm
\begin{longtabu}spread 0pt [c]{*{4}{|X[-1]}|}
\hline
\PBS\centering \cellcolor{\tableheadbgcolor}\textbf{ {\itshape Browser}   }&\PBS\centering \cellcolor{\tableheadbgcolor}\textbf{ {\itshape Websockets}   }&\PBS\centering \cellcolor{\tableheadbgcolor}\textbf{ {\itshape Streaming}   }&\PBS\centering \cellcolor{\tableheadbgcolor}\textbf{ {\itshape Polling}    }\\\cline{1-4}
\endfirsthead
\hline
\endfoot
\hline
\PBS\centering \cellcolor{\tableheadbgcolor}\textbf{ {\itshape Browser}   }&\PBS\centering \cellcolor{\tableheadbgcolor}\textbf{ {\itshape Websockets}   }&\PBS\centering \cellcolor{\tableheadbgcolor}\textbf{ {\itshape Streaming}   }&\PBS\centering \cellcolor{\tableheadbgcolor}\textbf{ {\itshape Polling}    }\\\cline{1-4}
\endhead
IE 8, 9   &same as above   &iframe-\/htmlfile   &iframe-\/xhr-\/polling    \\\cline{1-4}
Other   &same as above   &iframe-\/eventsource   &iframe-\/xhr-\/polling   \\\cline{1-4}
\end{longtabu}
\hypertarget{md_sfcode_node_modules_sockjs_client_README_autotoc_md28105}{}\doxysection{Supported transports, by name}\label{md_sfcode_node_modules_sockjs_client_README_autotoc_md28105}
\tabulinesep=1mm
\begin{longtabu}spread 0pt [c]{*{2}{|X[-1]}|}
\hline
\PBS\centering \cellcolor{\tableheadbgcolor}\textbf{ {\itshape Transport}   }&\PBS\centering \cellcolor{\tableheadbgcolor}\textbf{ {\itshape References}    }\\\cline{1-2}
\endfirsthead
\hline
\endfoot
\hline
\PBS\centering \cellcolor{\tableheadbgcolor}\textbf{ {\itshape Transport}   }&\PBS\centering \cellcolor{\tableheadbgcolor}\textbf{ {\itshape References}    }\\\cline{1-2}
\endhead
websocket (rfc6455)   &\href{https://www.rfc-editor.org/rfc/rfc6455.txt}{\texttt{ rfc 6455}}    \\\cline{1-2}
websocket (hixie-\/76)   &\href{https://tools.ietf.org/html/draft-hixie-thewebsocketprotocol-76}{\texttt{ draft-\/hixie-\/thewebsocketprotocol-\/76}}    \\\cline{1-2}
websocket (hybi-\/10)   &\href{https://tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-10}{\texttt{ draft-\/ietf-\/hybi-\/thewebsocketprotocol-\/10}}    \\\cline{1-2}
xhr-\/streaming   &Transport using \href{https://secure.wikimedia.org/wikipedia/en/wiki/XMLHttpRequest\#Cross-domain_requests}{\texttt{ Cross domain XHR}} \href{http://www.debugtheweb.com/test/teststreaming.aspx}{\texttt{ streaming}} capability (ready\+State=3).    \\\cline{1-2}
xdr-\/streaming   &Transport using \href{https://blogs.msdn.microsoft.com/ieinternals/2010/05/13/xdomainrequest-restrictions-limitations-and-workarounds/}{\texttt{ XDomain\+Request}} \href{http://www.debugtheweb.com/test/teststreaming.aspx}{\texttt{ streaming}} capability (ready\+State=3).    \\\cline{1-2}
eventsource   &\href{https://html.spec.whatwg.org/multipage/comms.html\#server-sent-events}{\texttt{ Event\+Source/\+Server-\/sent events}}.    \\\cline{1-2}
iframe-\/eventsource   &\href{https://html.spec.whatwg.org/multipage/comms.html\#server-sent-events}{\texttt{ Event\+Source/\+Server-\/sent events}} used from an \href{https://developer.mozilla.org/en/DOM/window.postMessage}{\texttt{ iframe via post\+Message}}.    \\\cline{1-2}
htmlfile   &\href{http://cometdaily.com/2007/11/18/ie-activexhtmlfile-transport-part-ii/}{\texttt{ Html\+File}}.    \\\cline{1-2}
iframe-\/htmlfile   &\href{http://cometdaily.com/2007/11/18/ie-activexhtmlfile-transport-part-ii/}{\texttt{ Html\+File}} used from an \href{https://developer.mozilla.org/en/DOM/window.postMessage}{\texttt{ iframe via post\+Message}}.    \\\cline{1-2}
xhr-\/polling   &Long-\/polling using \href{https://secure.wikimedia.org/wikipedia/en/wiki/XMLHttpRequest\#Cross-domain_requests}{\texttt{ cross domain XHR}}.    \\\cline{1-2}
xdr-\/polling   &Long-\/polling using \href{https://blogs.msdn.microsoft.com/ieinternals/2010/05/13/xdomainrequest-restrictions-limitations-and-workarounds/}{\texttt{ XDomain\+Request}}.    \\\cline{1-2}
iframe-\/xhr-\/polling   &Long-\/polling using normal AJAX from an \href{https://developer.mozilla.org/en/DOM/window.postMessage}{\texttt{ iframe via post\+Message}}.    \\\cline{1-2}
jsonp-\/polling   &Slow and old fashioned \href{https://secure.wikimedia.org/wikipedia/en/wiki/JSONP}{\texttt{ JSONP polling}}. This transport will show \char`\"{}busy indicator\char`\"{} (aka\+: \char`\"{}spinning wheel\char`\"{}) when sending data.   \\\cline{1-2}
\end{longtabu}
\hypertarget{md_sfcode_node_modules_sockjs_client_README_autotoc_md28106}{}\doxysection{Connecting to Sock\+JS without the client}\label{md_sfcode_node_modules_sockjs_client_README_autotoc_md28106}
Although the main point of Sock\+JS is to enable browser-\/to-\/server connectivity, it is possible to connect to Sock\+JS from an external application. Any Sock\+JS server complying with 0.\+3 protocol does support a raw Web\+Socket url. The raw Web\+Socket url for the test server looks like\+:


\begin{DoxyItemize}
\item ws\+://localhost\+:8081/echo/websocket
\end{DoxyItemize}

You can connect any Web\+Socket RFC 6455 compliant Web\+Socket client to this url. This can be a command line client, external application, third party code or even a browser (though I don\textquotesingle{}t know why you would want to do so).\hypertarget{md_sfcode_node_modules_sockjs_client_README_autotoc_md28107}{}\doxysection{Deployment}\label{md_sfcode_node_modules_sockjs_client_README_autotoc_md28107}
You should use a version of sockjs-\/client that supports the protocol used by your server. For example\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{<script src="{}https://cdn.jsdelivr.net/npm/sockjs-\/client@1/dist/sockjs.min.js"{}></script> }

\end{DoxyCode}


For server-\/side deployment tricks, especially about load balancing and session stickiness, take a look at the \href{https://github.com/sockjs/sockjs-node\#readme}{\texttt{ Sock\+JS-\/node readme}}.\hypertarget{md_sfcode_node_modules_sockjs_client_README_autotoc_md28108}{}\doxysection{Development and testing}\label{md_sfcode_node_modules_sockjs_client_README_autotoc_md28108}
Sock\+JS-\/client needs \href{https://nodejs.org/}{\texttt{ node.\+js}} for running a test server and Java\+Script minification. If you want to work on Sock\+JS-\/client source code, checkout the git repo and follow these steps\+: \begin{DoxyVerb}cd sockjs-client
npm install
\end{DoxyVerb}
 To generate Java\+Script, run\+: \begin{DoxyVerb}gulp browserify
\end{DoxyVerb}
 To generate minified Java\+Script, run\+: \begin{DoxyVerb}gulp browserify:min
\end{DoxyVerb}
 Both commands output into the {\ttfamily build} directory.\hypertarget{md_sfcode_node_modules_sockjs_client_README_autotoc_md28109}{}\doxysubsection{Testing}\label{md_sfcode_node_modules_sockjs_client_README_autotoc_md28109}
Automated testing provided by\+:

\href{https://browserstack.com}{\texttt{ }}

Once you\textquotesingle{}ve compiled the Sock\+JS-\/client you may want to check if your changes pass all the tests. \begin{DoxyVerb}npm run test:browser_local
\end{DoxyVerb}
 This will start \href{https://karma-runner.github.io}{\texttt{ karma}} and a test support server.\hypertarget{md_sfcode_node_modules_sockjs_client_README_autotoc_md28110}{}\doxysection{Browser Quirks}\label{md_sfcode_node_modules_sockjs_client_README_autotoc_md28110}
There are various browser quirks which we don\textquotesingle{}t intend to address\+:


\begin{DoxyItemize}
\item Pressing ESC in Firefox, before Firefox 20, closes the Sock\+JS connection. For a workaround and discussion see \href{https://github.com/sockjs/sockjs-client/issues/18}{\texttt{ \#18}}.
\item {\ttfamily jsonp-\/polling} transport will show a \char`\"{}spinning wheel\char`\"{} (aka. \char`\"{}busy indicator\char`\"{}) when sending data.
\item You can\textquotesingle{}t open more than one Sock\+JS connection to one domain at the same time due to \href{https://stackoverflow.com/questions/985431/max-parallel-http-connections-in-a-browser}{\texttt{ the browser\textquotesingle{}s limit of concurrent connections}} (this limit is not counting native Web\+Socket connections).
\item Although Sock\+JS is trying to escape any strange Unicode characters (even invalid ones -\/ \href{https://en.wikipedia.org/wiki/Mapping_of_Unicode_characters\#Surrogates}{\texttt{ like surrogates \textbackslash{}x\+D800-\/\textbackslash{}x\+DBFF}} or \href{https://en.wikipedia.org/wiki/Unicode\#Character_General_Category}{\texttt{ \textbackslash{}x\+FFFE and \textbackslash{}x\+FFFF}}) it\textquotesingle{}s advisable to use only valid characters. Using invalid characters is a bit slower, and may not work with Sock\+JS servers that have proper Unicode support.
\item Having a global function called {\ttfamily onmessage} or such is probably a bad idea, as it could be called by the built-\/in {\ttfamily post\+Message} API.
\item From Sock\+JS\textquotesingle{} point of view there is nothing special about SSL/\+HTTPS. Connecting between unencrypted and encrypted sites should work just fine.
\item Although Sock\+JS does its best to support both prefix and cookie based sticky sessions, the latter may not work well cross-\/domain with browsers that don\textquotesingle{}t accept third-\/party cookies by default (Safari). In order to get around this make sure you\textquotesingle{}re connecting to Sock\+JS from the same parent domain as the main site. For example \textquotesingle{}sockjs.\+a.\+com\textquotesingle{} is able to set cookies if you\textquotesingle{}re connecting from \textquotesingle{}www.\+a.\+com\textquotesingle{} or \textquotesingle{}a.\+com\textquotesingle{}.
\item Trying to connect from secure \char`\"{}https\+://\char`\"{} to insecure \char`\"{}http\+://\char`\"{} is not a good idea. The other way around should be fine.
\item Long polling is known to cause problems on Heroku, but a \href{https://github.com/sockjs/sockjs-node/issues/57\#issuecomment-5242187}{\texttt{ workaround for Sock\+JS is available}}.
\item Sock\+JS \href{https://github.com/sockjs/sockjs-client/issues/94}{\texttt{ websocket transport is more stable over SSL}}. If you\textquotesingle{}re a serious Sock\+JS user then consider using SSL (\href{https://www.ietf.org/mail-archive/web/hybi/current/msg01605.html}{\texttt{ more info}}). 
\end{DoxyItemize}