User Tools

Site Tools


websockets

Use of WebSockets in CLST-ASR

HTML5 WebSockets are used as one of the ways to communicate between client and ASR server. It is used to send and receive audio data for recognition and replaying. See following URLs for info on the WebSockets specification: Info on websockets: http://www.websocket.org/aboutwebsocket.html RFC with current version: http://tools.ietf.org/html/rfc6455 Latest published version W3C: http://www.w3.org/TR/websockets/

Modern browsers (IE 10+ era) seem to have native JavaScript support for this. See this URL which browsers support it and from what version: http://caniuse.com/#search=websockets

There are also libraries for various programming languages: JavaScript: http://socket.io Python: http://www.tornadoweb.org/en/stable/websocket.html Java: http://jwebsocket.org/

JavaScript usage

Communication through WebSockets can be set up in an HTML5 environment by using native browser support through JavaScript. Below are some links describing how to use WebSockets in such an environment: Tutorial on sending and receiving various types of data (text, XML, ArrayBuffer, Blob) with the use of XMLHttpRequest Level 2: http://www.html5rocks.com/en/tutorials/file/xhr2/#disqus_thread Plugin for sending and receiving binary data in Blobs and ArrayBuffers: http://www.artandlogic.com/blog/2013/11/jquery-ajax-blobs-and-array-buffers/ Old school method to send and receive binary data through XMLHttpRequest Level 1 (converting binary data to text/plain byte string): http://stackoverflow.com/a/4815486

Python usage

This link could be useful when sending binary data as a byte string. It concerns the encoding of the string, so client and server know how they should interprete the sent (or received) data: http://stackoverflow.com/questions/5766802/send-and-receive-binary-data-over-web-sockets-in-javascript

Problems with WebSockets

One of the things noticed in the DigLin and GOBL projects is that WebSocket communication is sometimes blocked by firewall / security software used in large institutions / corporations. Communication was altered to go through port 80 (HTTP), but still, at some companies WebSocket communication was blocked because of the sending of binary (audio) data. Firewalls cannot effectively scan binary data, so if set strict or not prepended by proper HTTP headers, the data packets are rejected.

Also, a permanent connection to the server is established (more server-CPU load).

Low security.

Not all client-apps can use websockets.

websockets.txt · Last modified: 2021/05/07 11:51 by ctejedor