Documentation
You are currently viewing documentation for version 3.0 which is not a long-term support release. The latest long-term support release is version 2.6

WebSockets

WebSockets is a full-duplex communication protocol for real-time messaging between a server and clients through persistent connections.

The main aim of WebSockets is to provide real-time notifications for clients about server events or changes without a need for the client to repeat requests to the server for new information. For example:

  • When someone changed the document another user was in progress of editing. In this case, a notification informing that someone is working with this document or that the document has been modified is immensely helpful.
  • Real-time charts of stock prices or currency exchange rates on financial portals. The accuracy and timeliness of this type of data is crucial for visitors of the portal and manual refreshment of the page can be very exhausting.
  • Real-time instant messaging on the website. Users must receive messages without refreshing the chat page.
  • etc.

How It Works

In Oro applications, WebSocket communications are built using Web Application Message Protocol (WAMP), a WebSockets subprotocol aimed at organizing the communication between program components in the applications with a loosely coupled architecture.

The main two parts of WAMP protocol are Remote Procedure Call (RPC) mechanism and PubSub messaging pattern.

RPC mechanism allows calling a function from a different code remotely via a WebSocket.

PubSub messaging pattern implies that when messages are published to topics by publishers (or in other words “channels”), the broker distributes them to clients that are subscribed to these topics.

Therefore, the WAMP protocol implies that there is a WebSocket server that plays a role of message broker; there are ways for the application components to register topics for messages, publish messages to topics and subscribe to topic messages.

In Oro applications, all WebSocket-related functionality is provided by OroSyncBundle. As OroSyncBundle is part of OroPlatform, which is the base for all Oro applications, the WebSockets functionality exists in all Oro applications.

Note

WebSockets functionality exists only in the admin UI of Oro applications which allows for guaranteed authentication of all clients who subscribe to the topic messages.

Getting Started

You need to Setup and Configure the Websockets functionality before you can start using it in Oro applications.

Out-of-the-box, OroSyncBundle uses WebSockets connection for two purposes:

  • Content outdating notifications — To provide flash notifications for the user informing about outdated content, if several users try to edit the same entity record simultaneously.
  • Maintenance mode notifications — To send flash notifications to all application site visitors once a developer turns on the system maintenance mode by a console’s CLI tool.

To start use websockets messages for your custom functionality, please, refer to the articles Create Your Own Topic for Publishing and Subscribing and Publish Messages to Existing Topics for the guidance.

You will be redirected to [title]. Would you like to continue?

Yes No
sso for www.magecore.comsso for oroinc.desso for oroinc.frsso for marketplace.orocommerce.comsso for marketplace.orocrm.com