File size: 591 Bytes
2b43822
 
 
9dffdbf
 
2b43822
9dffdbf
 
2b43822
 
9dffdbf
 
2b43822
9dffdbf
 
 
 
 
2b43822
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import { z } from "zod";
import { Context, Route } from "../hapticLinkServer";

export interface TestConnectionPayload { }
export const TestConnnectionSchema = z.object({})

export function TestConnectionHandler(ctx: Context<TestConnectionPayload>) {
    if (ctx.user) {
        return ctx.ws.send(JSON.stringify({
            "message": "test_connection_response",
            "authenticated": true,
            "username": ctx.user.username
        }))
    }
    return ctx.ws.send(JSON.stringify({
        "message": "test_connection_response",
        "authenticated": false,
    }))
}