Mattermost, Inc.

Real time message with websocket

Hello everyone, i have a litte question:
I m using websocket for native android mattermost app. I want the message to be in real time. I have already establish the connection, i have received the response. but how can i get the message with the help of websocket? Has anyone some examples pls? Thanks

Hi @yli,

When another user makes a post, you should receive a JSON-serialized message over the websocket like

{
    "event": "posted",
    "data": {
        "post": "{\"id\": \"1234\", \"message\": \"test message\"}" // a JSON-serialized Post object like you'd get from the API
    }
}

We’re working on proper documentation for our websocket API that will be available in a few days, but in the mean time, you can look here for an example of how our web app handles them.