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 33468fb commit b4544c8
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/happyx/bindings/python_types.nim
Original file line number Diff line number Diff line change
Expand Up @@ -78,25 +78,26 @@ when enableHttpBeast:
ws*: websocket.AsyncWebSocket
data*: string
state*: WebSocketState
proc newWebSocketObj*(ws: websocket.AsyncWebSocket, data: string = ""): python_types.WebSocket =
inc uniqueWebSocketId
python_types.WebSocket(ws: ws, data: data, id: uniqueWebSocketId, state: wssOpen)
else:
type
WebSocket* = ref object of PyNimObjectExperimental
id*: uint64
ws*: websocketx.WebSocket
data*: string
state*: WebSocketState
proc newWebSocketObj*(ws: websocketx.WebSocket, data: string = ""): python_types.WebSocket =
inc uniqueWebSocketId
python_types.WebSocket(ws: ws, data: data, id: uniqueWebSocketId, state: wssOpen)


var
requestModelsHidden* = RequestModels(requestModels: @[])
uniqueWebSocketId*: uint64 = 0


proc newWebSocketObj*(ws: websocketx.WebSocket, data: string = ""): python_types.WebSocket =
inc uniqueWebSocketId
python_types.WebSocket(ws: ws, data: data, id: uniqueWebSocketId, state: wssOpen)


proc processWebSocket*(py, locals: PyObject) =
discard py.eval("handler(**funcParams)", locals)

Expand Down

0 comments on commit b4544c8

Please sign in to comment.