Changeset View
Changeset View
Standalone View
Standalone View
keyserver/src/socket/socket.js
Show First 20 Lines • Show All 138 Lines • ▼ Show 20 Lines | const clientSocketMessageInputValidator = t.union([ | ||||
tShape({ | tShape({ | ||||
type: t.irreducible( | type: t.irreducible( | ||||
'clientSocketMessageTypes.API_REQUEST', | 'clientSocketMessageTypes.API_REQUEST', | ||||
x => x === clientSocketMessageTypes.API_REQUEST, | x => x === clientSocketMessageTypes.API_REQUEST, | ||||
), | ), | ||||
id: t.Number, | id: t.Number, | ||||
payload: tShape({ | payload: tShape({ | ||||
endpoint: t.String, | endpoint: t.String, | ||||
input: t.Object, | input: t.maybe(t.Object), | ||||
}), | }), | ||||
}), | }), | ||||
]); | ]); | ||||
function onConnection(ws: WebSocket, req: $Request) { | function onConnection(ws: WebSocket, req: $Request) { | ||||
assertSecureRequest(req); | assertSecureRequest(req); | ||||
new Socket(ws, req); | new Socket(ws, req); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 680 Lines • Show Last 20 Lines |