Introduction to websockets. Connecting to a TCP Socket from a browser using javascript

Websockets

Server events, discussed earlier, are an ideal tool when you need to receive a sequence of messages from a web server. But the connection turns out to be completely one-sided. The browser cannot respond to messages or engage in more complex dialogue with the server.

If you're building a web application that requires significant two-way communication between the browser and the web server, the best approach to implement it (without resorting to Flash help) will possibly use the XMLHttpRequest object. Depending on type the application being created this approach may work as required. But there are a fair number of possible problems here.

First of all, the XMLHttpRequest object is not very good for quick exchange multiple messages (for example, in chat). Then, there is no way to link one call to another, so with each new request from a web page, the server must figure out from the very beginning who this page belongs to. Therefore, the level of complexity of the code to handle a series of related requests from a web page can very quickly grow to the point of being practically impossible to implement.

There is a solution for all these problems, although it is not quite ready yet. This solution is web sockets technology, which allows the browser to maintain an open connection to the server and exchange messages for any desired time.

Websocket technology has caused a lot of excitement among web developers, but it is still in the process of development, although it already has good browser compatibility:

On this moment The best way to test pages that use websockets is in Chrome browser which provides the most consistent support for them.

Accessing websockets

Websockets are a specialized tool. They are relevant for applications such as chat, massive multiplayer games or a peer-to-peer communication tool. Websockets allow you to create new types of applications, but they are used in most modern web applications, driven by JavaScript, most likely doesn't make sense.

Websocket solutions can be extremely complex. Developing JavaScript code for one page will be a fairly simple task. But to create a server application, you'll need a ton of programming knowledge and skills, including an understanding of the concepts of multithreading and networking.

To use websockets, your site's web server must be running special program, which would be expected to be called a websocket server. This program is responsible for coordinating the interaction of all participants, and once launched, it works non-stop.

Many hosting companies do not allow long-running programs unless you pay for a dedicated web server, i.e. a server that serves only your website. If you have a regular shared hosting, you most likely won't be able to host pages that use websockets on it. Even if you manage to get a websocket server running and keep it running, your hosting owner will most likely identify it and shut it down.

To give you an idea of ​​the scope of a websocket server, consider some of the tasks that a socket server must perform:

    compile a “dictionary” of messages, in other words, decide which types of messages are acceptable and which are not;

    identify errors when sending messages to customers and stop trying to contact them if they seem to no longer exist;

    process all data in random access memory, i.e. data that all clients may need access to, and to do so securely and reliably. There are a lot of possible implicit problems here, such as when one client tries to join the exchange while the other is disconnected, and information about both is stored in the same object in memory.

Developers will most likely never create their own server program, using websockets, because it's simply not worth the significant effort required. The easiest approach in this area would be to install someone else's websocket server and develop your web pages for it. Since using the JavaScript portion of the websocket standard is straightforward, this shouldn't cause any problems.

Another approach would be to take someone else's websocket server code and tailor it to your requirements. Currently, there are a great many projects (many of which are free and with open source), in which websocket servers are being developed to solve various tasks, in different server programming languages.

Simple websocket client

From a web page's perspective, websocket functionality is easy to understand and use. The first step is to create a WebSocket object and pass a URL to it. The code for this is similar to the following:

Var socket = new WebSocket("ws://localhost/socketServer.php");

The URL string begins with the text ws://, which identifies the web socket connection. This URL points to the web application file on the server (in in this case this is the socketServer.php script).

The Web Sockets standard also supports URLs that begin with the text wss://, which indicates the requirement to use a secure, encrypted connection (just as when requesting a web page, specify a URL that begins with https:// instead of http: //).

Websockets can connect to more than just their web server. A web page can open a connection to a web socket server running on another web server without requiring any additional effort.

The very act of creating a WebSocket object forces the page to attempt to connect to the server. Next, you need to use one of the four events of the WebSocket object: onOpen (when a connection is established), onError (when an error occurs), onClose (when the connection is closed), and onMessage (when the page receives a message from the server):

Socket.onopen = connectionOpen; socket.onmessage = messageReceived; socket.onerror = errorOccurred; socket.onopen = connectionClosed;

For example, if the connection is successful, it would be nice to send a corresponding confirmation message. This message is delivered using the method send() a WebSocket object that is passed plain text as a parameter. The following is a function that handles the onopen event and sends a message:

Function connectionOpen() ( socket.send("UserName: [email protected]"); }

Presumably the web server will receive this message and respond to it.

The onError and onClose events can be used to send notifications to the visitor of a web page. But by far the most important is the onMessage event, which fires when new data is received from the server. Yet again, JavaScript code Handling this event is straightforward - we simply extract the message text from the data property:

Function messageReceived(e) ( messageLog.innerHTML += "

If the web page decides that all its work is done, it can close the connection using the method disconnect():

Socket.disconnect();

From this overview of websockets you can see that using a websocket server third party developer does not present any difficulties - we just need to know which messages to send and which to expect.

There is a lot of work done behind the scenes to make websocket connections work. First of all, the web page establishes a connection via normal standard HTTP. This connection then needs to be upgraded to a websocket connection, allowing free two-way communication. There may be problems at this point if there is a proxy server between the client's computer and the web server (as, for example, in a typical corporate network). The proxy server may refuse to cooperate and will terminate the connection. This issue can be resolved by detecting a failed connection (via the WebSocket object's onError event) and applying one of the socket polyfills described on the GitHub website. These placeholders use a polling method to emulate a websocket connection.

Examples of websockets on the web

If you're interested in trying out websockets, there are many sites online where you can get your development started.

To get started, try websocket.org, which provides the simplest server websockets: a web page sends a message to it, and it returns the same message to the web page:

Although this websocket server is nothing special, it allows you to try out all the features of the WebSocket object. Moreover, you can connect to this server from a page located on both the production web server and the test web server on your computer, or even from a page simply launched from your hard drive:

Var socket = new WebSocket("ws://echo.websocket.org"); socket.onopen = connectionOpen; socket.onmessage = messageReceived; function connectionOpen() ( socket.send("UserName: [email protected]"); ) function messageReceived(e) ( var messageLog = document.getElementById("messageLog"); messageLog.innerHTML += "
" + "Server response: " + e.data; )

There are also websocket servers that provide other capabilities, including the following.

I have a vb.net application that opens a socket and listens on it.

I need to communicate through this socket with this application using javascript running in the browser. That is, I need to send some data to this socket so that the application that is listening on this socket can accept this data, do some things using some remote calls, and receive some more data and put it back on the socket, which is the javascript I need. read and print it in your browser.

Ive tried, socket.io, websockify, but none of them were helpful.

Hence the question is, what am I even trying to make possible? Is there a way that javascript running in the browser can connect to tcp socket and send some data and listen to it to receive some data response on the socket and print it in the browser.

If possible, can someone point me in the right direction to help me set a goal.

6 answers

Regarding your problem, currently you will have to depend on XHR or webhosts for this.

To access this API, you need to enable the experiment flag in your extensions manifest. Using sockets is quite simple, for example:

Chrome.experimental.socket.create("tcp", "127.0.0.1", 8080, function(socketInfo) ( chrome.experimental.socket.connect(socketInfo.socketId, function (result) ( chrome.experimental.socket.write( socketInfo.socketId, "Hello, world!");

You can use HTML5 Web Sockets:

Var connection = new WebSocket("ws://IPAddress:Port"); connection.onopen = function () ( connection.send("Ping"); // Send the message "Ping" to the server );

Your server must also listen to a WebSocket server such as pywebsocket, otherwise you can write your own as described in Mozilla

Additionally:

This will be possible through the navigator interface as shown below:

Navigator.tcpPermission.requestPermission((remoteAddress:"127.0.0.1", remotePort:6789)).then(() => ( // Permission was granted // Create a new TCP client socket and connect to remote host var mySocket = new TCPSocket("127.0.0.1", 6789); // Send data to server mySocket.writeable.write("Hello World").then(() => ( // Data sent sucessfully, wait for response console.log("Data has been sent to server");

// Host we are connecting to var host = "localhost";

// Port we are connecting on var port = 3000;

var socket = new jSocket();

// When the socket is added the to document socket.onReady = function())( socket.connect(host, port); ) // Connection attempt finished socket.onConnect = function(success, msg)( if(success)( / / Send something to the socket socket.write("Hello world");else( alert("Connection to the server could not be estabilished: " + msg); ) ) socket.onData = function(data)( alert(" Received from socket: "+data); ) // Setup our socket in the div with the id="socket" socket.setup("mySocket");

To achieve what you want, you need to write two applications (for example, in Java or Python):

  • A Bridge application that resides on the client computer and can work with both TCP/IP and WebSockets sockets. It will communicate with the TCP/IP socket in question.
  • A server application (such as a JSP/Servlet WAR) that can communicate via WebSockets. It includes at least one HTML page (including server-side processing code if necessary) for access through a browser.
  • It should work like this
  • Bridge will open a WS connection to the web application (since the server cannot connect to the client).
  • The web application will ask the client to identify himself
  • The bridge client sends some identifying information to the server, which stores it to identify the bridge.
  • The page to be viewed in the browser connects to the WS server using JS.
  • Repeat step 3 but for a JS based page
  • The JS based page sends a command to the server, including which bridge it should go to.
  • The server redirects the command to the bridge.
  • The bridge opens a TCP/IP socket and interacts with it (sends a message, receives a response).
  • The bridge sends a response to the server via WS
  • WS forwards the response to the page for viewing in the browser

    JS processes the response and reacts accordingly

    This article explains how to use websockets to create web applications. But before we dive into the WebSocket protocol and API, let's take a look at the problems that web applications face and how WebSocket helps solve them.

    A Brief History of Real-Time Web Applications

    The Internet was built on the idea that the browser's job is to request data from the server, and the server's job is to serve those requests. This paradigm has not been challenged for several years. But with the advent of AJAX in 2005, many people began working on creating bidirectional connections.

    Web applications have grown significantly in size. The limiting factor to their growth was the traditional HTTP model. To overcome this, several strategies have been created to allow servers to “push” data to the client. One of the most popular was the “long survey” strategy. It involves keeping the HTTP connection open as long as the server has data to send to the client.

    But all these technologies lead to HTTP overload. Every time you make an HTTP request, a set of headers and a cookie are sent to the server. They accumulate into large amounts of information that need to be transmitted. This increases latency, which can be critical to the smooth running of the application.

    To solve this problem, we needed a way to create a persistent connection with minimal latency that could support transactions initiated by both the client and the server. This is exactly what websockets provide.

    How websockets work

    A websocket creates a persistent connection between a client and server that both parties can use to send data.

    The browser establishes a web socket connection using a handshake. This process begins with the client sending the usual HTTP request to the server. This request includes an Upgrade header, which tells the server that the browser wants to establish a web socket connection.

    Here is a simplified example of the initial request headers.

    GET ws://websocket.example.com/ HTTP/1.1

    Origin: http://example.com

    Connection: Upgrade

    Host: websocket.example.com

    Upgrade: websocket

    Note: Websocket URLs use the ws protocol. There is also a wss protocol for secure connections, which is the equivalent of HTTPS.

    If the server supports the WebSocket protocol, it indicates this using the Upgrade header in the response.

    HTTP/1.1 101 WebSocket Protocol Handshake

    Connection: Upgrade

    Upgrade: WebSocket

    After the handshake is completed, the initial HTTP connection is replaced by a websocket connection, which uses the same TCP/IP connection. At this point, either party can start sending data.

    Using websockets, you can transfer an unlimited amount of information without adding request-related data (like HTTP). Data is sent over a websocket as messages, each consisting of one or more fragments.

    To ensure that the message will be interpreted correctly on the client side, each fragment is preceded by 4 to 12 bytes of payload data. Using chunk-based messaging reduces the overhead of data, resulting in lower latency.

    Note: It is worth noting that the client will only be notified of a new message when the server has transmitted all its fragments.

    Creating a demo example Creating an application based on web sockets

    We will create a simple application that connects to a server using a websocket. Before we dive into the details of the API, we need to create a few files.

    View example

    Download code

    View on CodePen

    Create an index.html file and add the following markup to it.

    WebSockets Demo WebSockets Demo Connecting... Send Message Close Connection

    The element is intended to display messages about the connection status. The list will be used to display messages sent and received from the server. The web form is designed for entering messages.

    The style.css file this code references is in the download zip. Next, let's create an app.js file and add the following code to it.

    window.onload = function() ( // Get links to page elements. var form = document.getElementById("message-form"); var messageField = document.getElementById("message"); var messagesList = document.getElementById(" messages"); varsocketStatus = document.getElementById("status"); varcloseBtn = document.getElementById("close"); // The rest of the code from this article will be added below... );

    We created several variables and initialized them with references to key elements of the page.

    Opening connections

    Now that the skeleton of the application is ready, you can start exploring the WebSocket API. First, let's learn how to create a new WebSocket connection. To do this, you need to call the constructor of the WebSocket class and pass it the server URL.

    Copy the following code into your app.js file to create a new connection.

    // Create a new WebSocket object. varsocket = new WebSocket("ws://echo.websocket.org");

    Once the connection is established, the WebSocket object's open event will fire. Let's add an event handler that will update the element's status with a message that the connection has been established.

    // Show a "connected" message when opening a websocket. socket.onopen = function(event) ( socketStatus.innerHTML = "Connected to: " + event.currentTarget.url; socketStatus.className = "open"; );

    We also add the open class to the element.

    Error processing

    Error handling is done through the error event. Add the following code which will log errors to the console.

    // Handling errors that occur. socket.onerror = function(error) ( console.log("WebSocket Error: " + error); );

    Sending messages

    To send a message over a websocket, you need to call the send() method of the WebSocket object, passing it the data to send.

    socket.send(data);

    You can send both text and binary data. In our application we need to transfer content text field to the server when the form is submitted. To do this, you need to define a handler for the form submit event.

    Add the following code to your app.js file.

    // Send a message when the form is submitted form.onsubmit = function(e) ( e.preventDefault(); // Receive a message from a text field. var message = messageField.value; // Send a message over a web socket. socket.send( message); // Adding a message to the message list. messagesList.innerHTML += "Sent:" + message + ""; // Clearing the text field. messageField.value = ""; return false; );

    When the form is submitted, the above code will receive the message from messageField and send it via websocket. The message is then added to messagesList and displayed on the screen. The value of messageField is then cleared so that the user can enter a new message.

    Receiving messages

    When a message is received, the message event is raised. It includes a data property that can be used to access the contents of the message.

    We need to create an event handler that will be called when a new message is received. It should receive the message from the event and display it in messagesList .

    To achieve this, copy the following code into your app.js file.

    // Processing messages sent by the server. socket.onmessage = function(event) ( var message = event.data; messagesList.innerHTML += "Received:" + message + ""; };

    Closing connections

    When you are done with the websocket you need to release the connection using close method() .

    After the connection is closed, the browser will fire a close event. Adding a close event handler will allow you to do any cleanup that is needed.

    Now we need to update the connection status when it breaks. Add the following code to your app.js file:

    // Show a "disconnected" message when the connection is lost. socket.onclose = function(event) ( socketStatus.innerHTML = "Disconnectedfrom WebSocket."; socketStatus.className = "closed"; );

    To terminate the application, you need to add an event handler that will be called when the Close Connection button is clicked. It must call the close() method of the WebSocket object.

    // Close the connection when the "close" button is pressed closeBtn.onclick = function(e) ( e.preventDefault(); // Close the web socket. socket.close(); return false; );

    Our application is ready!

    Open the index.html file in your browser and try sending a few messages. You will see the server sending messages back.

    Monitor websocket traffic using developer tools in Chrome


    "Developer Tools" available in Google browser Chrome includes tools for monitoring traffic. To use this tool:

    • Open Developer Tools.
    • Go to the Network tab.
    • Click on the entry corresponding to your websocket connection.
    • Go to the Frames tab.

    These tools provide general information about the data transferred through the connection.

    WebSocket on the server

    In this article, we focused on how to use websockets on the client side. If you want to create your own WebSocket server, there are many libraries that can help. One of the most popular is socket.io, a Node.JS library.

    Other libraries:

    • C++: libwebsockets;
    • Erlang: Shirasu.ws;
    • Java: Jetty;
    • Node.JS: ws ;
    • Ruby: em-websocket ;
    • Python: Tornado, pywebsocket;
    • PHP: Ratchet, phpws.
    Browser support

    Websockets are supported in almost all modern browsers. The only exceptions are Android browsers and Opera Mini.

    Your browser may not support the functionality in this article.

    Problem: response time when exchanging data between server and client

    The Internet was created primarily based on the so-called request-response paradigm, implemented using the HTTP protocol. It lies in the fact that until the client sends a request to open next page, it won't load. Since about 2005 with the advent AJAX technologies Internet work has become more dynamic. At the same time, data exchange via the HTTP protocol was still initiated by the client, and this required the user to perform certain actions or periodically polling the server to download updated information.

    Technologies that allow the server to send new data to the client as it becomes available have existed for quite some time. They are known as Push or Comet. One common way to create the illusion of a server-initiated connection is the so-called long polling method. Its essence is that the client creates a connection to the HTTP server and it does not close until the response is sent. If the server actually has updated data, it sends a response (other technologies use Flash, multipart XHR requests, and special HTML files for this). Long polling technology, like other similar techniques, works great. You use them every day, for example, in Gmail chat.

    However, this method has one drawback: it uses HTTP protocol, which is not well suited for applications with low response times. Specifically, I'm referring to multiplayer browser-based first-person arcade games and others network games in real time.

    Introducing the WebSocket Protocol: Using WebSockets on the Internet

    The WebSockets specification defines an API for creating socket connections between a browser and a server. In other words, between the client and the server it is established permanent connection, in which both parties can initiate data exchange.

    Beginning of work

    To create a WebSocket connection, you can call the appropriate constructor.

    Var connection = new WebSocket("ws://html5rocks.websocket.org/echo", ["soap", "xmpp"]);

    Note ws:: this is the new URL scheme for websockets. The wss: scheme is also used to create secure web sockets, similar to the https: protocol for secure HTTP connections.

    Connection-related event handlers are used to receive information about new connections, incoming messages, and errors.

    The second argument allows the use of additional subprotocols. This can be a string or an array of strings. Each of them must correspond to the name of the subprotocol, and the server accepts only one of the parameters passed using an array. The list of supported subprotocols is given in the protocol property of the WebSocket object.

    Subprotocol names must be consistent with the IANA registry. As of February 2012, only one such name (soap) is registered.

    // When the connection is open, send some data to the server connection.onopen = function () ( connection.send("Ping"); // Send the message "Ping" to the server ); // Log errors connection.onerror = function (error) ( console.log("WebSocket Error " + error); ); // Log messages from the server connection.onmessage = function (e) ( console.log("Server: " + e.data); );

    Data exchange with the server

    After establishing a connection with the server (the open event is fired), you can send data to it using the send("message") method of the connection object. Previously it only accepted strings, but in latest version specifications and binary messages are supported. Blob and ArrayBuffer objects are used to send such data.

    // Sending String connection.send("your message"); // Sending canvas ImageData as ArrayBuffer var img = canvas_context.getImageData(0, 0, 400, 320); var binary = new Uint8Array(img.data.length); for (var i = 0; i

    The server can also send us a message at any time. When this happens, the onmessage callback is fired. This call receives an event object, and the resulting message can be seen in the data property.

    According to the latest version of the specification, the WebSocket object is also capable of receiving binary messages. Binary frames can be received in Blob or ArrayBuffer formats. To specify the format of the resulting binary frame, you must set the WebSocket object's binaryType property to blob or arraybuffer. The default format is blob. (You do not need to check the binaryType parameter when sending.)

    // Setting binaryType to accept received binary as either "blob" or "arraybuffer" connection.binaryType = "arraybuffer"; connection.onmessage = function(e) ( console.log(e.data.byteLength); // ArrayBuffer object if binary );

    One more new feature WebSocket are extensions. With their help, you can send compressed, multiplexed frames, etc. The list of extensions supported by the server is given in the extensions property of the WebSocket object after the open event is fired. As of February 2012, there are no official specifications for extensions.

    // Determining accepted extensions console.log(connection.extensions);

    Exchange data between different domains

    The protocol for exchanging data between different domains was recently developed and is perfectly suited for WebSocket technology. It allows you to exchange data between sources in different domains, although, as before, attention should be paid to their reliability. Server rules determine whether the service will be available to all clients or only to certain domains.

    Proxy servers

    Any new technology has its own underwater rocks. For the WebSocket protocol, the problem is compatibility with proxy servers - intermediaries in HTTP connections in most corporate networks. The WebSocket protocol uses the HTTP modernization system (commonly used for HTTP/SSL) to "upgrade" the HTTP connection over this protocol. Some proxy servers do not support it and the connection will fail. Thus, even if the client uses the WebSocket protocol, it will not be possible to establish a connection. Therefore, the next section is extremely important.

    Benefits of WebSockets Today

    WebSocket technology has only recently emerged and is not fully implemented in all browsers. Despite this, you can use the libraries mentioned above for implementation in cases where the WebSocket protocol is not supported. One of the most popular libraries is socket.io, which provides both server- and client-side protocol capabilities and is backwards compatible (as of February 2012, socket.io does not support binary messaging). There are also commercial solutions, for example PusherApp, which is easily integrated into any web applications and implements sending WebSocket messages to clients with using the API based on HTTP. Using HTTP requests invariably increases resource consumption compared to standard technology WebSocket.

    Server side

    The use of the WebSocket protocol changes the approach to using server applications. Although traditional server sets software, such as LAMP, are designed for a normal HTTP-based request-response cycle, they often perform poorly in large number WebSocket connections. A large number of simultaneous connections fundamentally requires new architecture, which combines low resource intensity with capabilities parallel work. Such architectures are usually created based on a streaming or so-called non-blocking data exchange system.

    What is WebSocket. Which is better - Websockets or AJAX?

    5 (100%) 3 votes

    WebSocket is a full-duplex communication protocol over a TCP connection. That is, using this protocol, you can transmit and receive a message simultaneously. It allows real-time exchange of messages between the browser and the server.

    Web sockets have not been experimental for a long time; they are used in browser games, interactive systems, and payment systems. WebSockets have already become part of the modern web!

    Browser is a web server. How does it work and what needs to be changed?

    For web developers, it has always been a problem to get the browser to react to events that occur on the server. The HTTP protocol has some shortcomings, and it has probably been criticized by all developers. One of these disadvantages is the problem of a permanent connection to the server. The implementation of the HTTP protocol did not involve this kind of interactions. For example, if we want to receive data from the server to the browser, then we need to make another request to the server, and this involves reloading the page. That is, if you opened the site in a browser, loaded the page, viewed it, and by this time the server has changed this page, then we need to reload the page to get the change.

    There are quite a large number of tasks where we need to achieve asynchrony using the HTTP protocol. That is, if there are changes to the server, then you need to receive these changes in the browser, without rebooting. One such example is a chat where people communicate, and when one sends messages to another, the message is visible to the recipient instantly, without reloading the page. Previously, creating this type of application was not easy, there were different degrees of interpretation that simulated server push actions. One such example is client-based frames that reload once per second and send requests to the server.

    This approach has many disadvantages - a very large number of requests are created on the server, it is difficult to organize correct structure applications. I am the the main problem- this is what we do to emulate a reaction to a server event. The client (browser) always receives data with a long delay.

    Now let's talk about AJAX. When the XMLHTTPRequest object appeared in browsers, things improved a little. In this case, we can interact with the server using the Long Polling scheme. The essence of this scheme is described point by point below:

    • The client (browser) sends a request to the server,
    • The connection does not close and the client waits for an event to occur.
    • When the event occurs, the client receives a response to its request,
    • The client immediately sends a new request.

    With this approach we receive asynchronous requests to the server and the responses are processed using functions callback. But this approach also has some disadvantages. Main disadvantage This approach is that here the server and server events are not the initiator of the interaction.

    Not long ago, a new protocol appeared that does not have the disadvantages that we listed above. New technology WebSockets is an implementation of a full-duplex communication protocol over a TCP connection.

    Why WebSockets? Pros and cons of the ws protocol

    Using Web Sockets technology, we need to forget the usual system of interaction in the WWW world. We need to score standard model HTTP protocol - “request/response to request”. Within the framework of Web Sockets technology, the browser and server can send and receive data at any time, that is, they become equal participants.

    WebSocket establishes one single client-server connection. To work with WebSockets, both sides (client and server) must support this technology. All new browsers support the WS protocol, and the server part is implemented by the developer. When the server and client are ready to “fight”, the server and client can send text messages via Web Sockets text message. Data transmission and reception occurs immediately; this technology creates bidirectional communication channels.

    Since the connection to the client and server is not closed (it is kept open constantly), this avoids the transfer of unnecessary data (HTTP headers). There are no quantity restrictions in the WebSockets standard open connection and according to the order of requests.

    In this lesson we learned what methods there are for asynchronous requests to the server, what WebSocket is and what advantages it has over AJAX and HTML frames. In the next lesson we will start working with WebSocket on Node.js, we will look at this technology in action in more detail and write a chat on WebSockets and Node.js. You can find a complete list of Node.js lessons.