Skip to content

Commit

Permalink
imporve py
Browse files Browse the repository at this point in the history
  • Loading branch information
Ethosa committed Jan 13, 2024
1 parent 4d509c8 commit b964872
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/happyx/ssr/handlers.nim
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,19 @@ elif exportPython:
# Create Python class instance
pyFuncParams[param] = requestModel.from_dict(requestModel, pyFuncParams[param])
if route.httpMethod == @["WEBSOCKET"]:
let wsClient = await newWebSocket(req)
let wsClient =
when enableHttpBeast:
headers = req.headers.get()
req.forget()
req.client.AsyncFD.register()
let socket = newAsyncSocket()
let (wsClient, error) = await verifyWebsocketRequest(socket, headers, "")
if wsClient.isNil:
socket.close()
return
wsClient
else:
await newWebSocket(req)
# Declare route handler
let wsConnection = newWebSocketObj(wsClient, "")
if handlerParams.hasParamType("WebSocket"):
Expand Down

0 comments on commit b964872

Please sign in to comment.