Allow specifying a WS closing code to TemplatedApp.close()

Open
#1,911 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
cpp

Research direction

Start at the C++ implementation of TemplatedApp.close() and trace how WebSocket connections are closed. Determine how a caller could provide a WebSocket closing code, then verify that connected clients receive that code when the server shuts down.

Written by the indexing model from the issue text.

Description

Hello,

As per documentation, the TemplatedApp.close() method "closes all sockets including listen sockets". For WS servers this means that all WS connections are closed without a closing code (I'm guessing the underlying TCP socket is the one that is actually closed) and the reported code is 1006.

It would be useful to have a way for specifying the WS closing code to send to the clients. This way, applications can identify and handle on the client side the situation of a server being closed.

Dominant language
C++
Stars
19k
Forks
1.9k
Avg merge
3h 24m
Merged PRs (30d)
5

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from uNetworking/uWebSockets

All issues in uNetworking/uWebSockets

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.