Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

send events to the room #28

Merged
merged 3 commits into from
Aug 31, 2023
Merged

Conversation

iammuho
Copy link
Owner

@iammuho iammuho commented Aug 31, 2023

Related issue: #20


This PR enables clients to send the events to the related rooms (like typing.started, typing.stopped) and the API server after process the data (like if the room exists, if the user in in the room etc) will forward the event to the connected websocket users except the sender ID.

Sample Request:

POST /api/v1/chat/room/a0b0b227-8162-40d9-a4dd-1968d22061eb/event HTTP/1.1
...
{
    "event_type": "typing.started"
}

Websocket Message:

{
    "connection_id": "2",
    "type": "room.event",
    "message": {
        "event_type": "typing.started",
        "room_id": "a0b0b227-8162-40d9-a4dd-1968d22061eb",
        "user_id": "b2c2bd94-6e15-4b97-8a0e-105af958d2d3"
    },
    "created_at": 1693490966
}

So the client can parse the data, and show the related field. This is the most extensible solution for not just typing events, but can be configured by the client itself.

@iammuho iammuho added the enhancement New feature or request label Aug 31, 2023
@iammuho iammuho merged commit 309634f into main Aug 31, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants