Add support for ping messages in server for determining latency
This commit is contained in:
@@ -137,6 +137,10 @@ const server = Bun.serve<WSData>({
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (msg.type) {
|
switch (msg.type) {
|
||||||
|
case "ping": {
|
||||||
|
ws.send(JSON.stringify({ type: "pong", timestamp: msg.timestamp }));
|
||||||
|
break;
|
||||||
|
}
|
||||||
case "create_room": {
|
case "create_room": {
|
||||||
const username = (msg.username || "").trim();
|
const username = (msg.username || "").trim();
|
||||||
if (!username) {
|
if (!username) {
|
||||||
|
|||||||
Reference in New Issue
Block a user