Communication between two users using real time api

Can you format your code when you paste it? It makes it much easier to read!

I copied a bit of yours to https://beautifier.io/ to test

{
    “msg”: “method”,
    “method”: “sendMessage”,
    “params”: [{
        "_id": “user-id”,
        “rid”: “room-id,”,    <<< extra comma here after room-id? 
        “msg”: “Hello Hassan!”
    }],
    “id”: “48”
}

It should look like this from the docs?

{
    "msg": "method",
    "method": "sendMessage",
    "id": "42",
    "params": [
        {
            "_id": "message-id",
            "rid": "room-id",
            "msg": "Hello World!"
        }
    ]
}

Yours seems to be missing:

"_id": "message-id",

Please go back and check all your code carefully, and use our examples to test.

1 Like