mattermost-api-reference icon indicating copy to clipboard operation
mattermost-api-reference copied to clipboard

Help Wanted: websocket event datastructure is not documented

Open Psycojoker opened this issue 6 years ago • 2 comments

Hello,

Mattermost API reference provides a list of event sockets here https://api.mattermost.com/#tag/WebSocket, which is very useful, but doesn't provide any example of the sent data structure which makes development more complicated (I've search the documentation for the event names and couldn't find anything) (my only 2 solutions are to wait for an event, copy/paste it and interfere from that hopping to have all on them one day or to read the source of mattermost)

Would it be possible to had this in the documentation? I can provide the event samples I've already gathered if that makes things easier.

Kind regards,

Psycojoker avatar Feb 28 '19 00:02 Psycojoker

@Psycojoker can you please write a sample you think should be documented? I am feeling like working on this ticket.

tapaswenipathak avatar May 26 '19 17:05 tapaswenipathak

@tapaswenipathak one simple thing to start would be to give the basic structure of all existing websockets event with an example, a bit like in the github api documentation: https://developer.github.com/v3/activity/events/types/#createevent

Right now you only have a list of event name but absolutely no idea of their structure so you can't write code to handle them until you have at least received one of them to see how they look.

For example this is how the "channel_created" event looks like:

{
    u'broadcast': {
        u'omit_users': None,
        u'channel_id': u'', 
        u'team_id': u'', 
        u'user_id': u'some_id'
    }, 
    u'data': {
        u'channel_id': u'some_id', 
        u'team_id': u'some_id'
    }, 
    u'event': u'channel_created', 
    u'seq': 6
}

What would be even better would be to have documentation explaining what is this event, we it occurs, how you should handle it and some explanations of non-obvious field.

Also I'm sorry, I really don't have the time to do that and I'm not working that much on mattermost API for now :/ (life has changed)

Psycojoker avatar May 26 '19 17:05 Psycojoker