Anyone try with Chat WSS ?

Today I try to connect to chat WSS and I got this error:


I replace listenKey and listentoken and put wss format as FAQ:

Where did you obtain wss:// URL ?

from here: P2P Merchant Portal

5.4 SAPI notification and chat related FAQ

Q1: How to get notifications of orders or chat?

It can be found In the response of this API


Then, get the wss url and the credential as following

    ""code"": ""000000"",
    ""message"": ""success"",
    ""data"": {
        ""chatWssUrl"": ""wss://"",
        ""listenKey"": ""c2c_xxxxxxxxxxxxxx"",
        ""listenToken"": ""TOKENxxxxxxxxx""
    ""success"": true

Next, you should connect to wss by


Finally resolve the problem.

The problem come from calling the retrieveChatCredential API incorrectly.

Change “clientType”: ‘any’ to “clientType”: ‘web’ had fixed the problem.

@Hen_Si Thank you.
My socket is connected, and new messages are received.
Please help me how to send message via socket

1 Like

So how to send messages to chat, somebody know?