Web - TypeScript/React
Last updated
Was this helpful?
Last updated
Was this helpful?
Follow this step-by-step tutorial to create basic implementation of Chat SDK.
A Sceenic account
Code Editor( , )
NPM access token for Chat SDK
API_KEY and API_SECRET
An Access Token
is needed in order to allow a client to connect to chat service.
Note: It is important that the client application does not request an Access Token directly from the frontend. By doing that you risk exposing the API_KEY and API_SECRET.
A successful response will look like that:
Note: Every chat token corresponds to one specific user only.
When moving from the Sandbox environment to production you will need to implement your own authentication server. This server will supply the various clients (Web, Android, and iOS) with a valid Access Token so that they can use the service.
For that you will need:
Your own working authentication server
To create a project we recommended using the following stack: React + TypeScript + ChatSDK.
Create an empty React + Typescript project
Create .npmrc file. In the project’s root folder
Put your Access Token
inside //registry.npmjs.org/:_authToken=YOUR_ACCESS_TOKEN
.
Install Chat SDK via npm i @sscale/chatsdk
.
Add the following import
Create chat SDK instance
Connect to server
Create chat room
Subscribe to room's or any messages
or
Send message to room
In addition, have a look at the extra features available for you:
The Access Token
is a JWT token - more about jwt you can read - .
You can get your API_KEY and API_SECRET in your private area, .
API_KEY, and API_SECRET - can be retrieved in your private area once you
For more information on NPM installation look .
Have a look at the and it's to see all the features and chat SDK API documentation .
Need technical support? contact us at .