By Admin on Tuesday, 24 March 2020
Category: All

sgcWebSockets and React client

​sgcWebSockets library fully supports RFC6455, so any client that supports this RFC will be able to connect to our servers.

You can connect with REACT to sgcWebSockets library without problems, just create a new class which implements WebSocket class and use it to connect, send messages, receive messages from server...

React WebSocket Example

 In order to use WebSocket protocol in React, you must use instantiate WebSocket class, passing websocket url as argument (example: ws://echo.websocket.org) and then bind websocket events to be notified when socket is connected, disconnected or a new message arrives. Find below a very simple sample react code, which shows how connect to a websocket server and send a message after a successful connection.

ASP.NET Core React Example 

 You can build React Apps using ASP .NET Core, find below a link to download a full Visual Studio Project, showing a demo that connects to our secure websocket server chat.

https://www.esegece.com/download/sgcWebSocketsReact.zip

Related Posts