src/whisky

Source   Edit  

Types

Message = object
  kind*: MessageKind
  data*: string
Source   Edit  
MessageKind = enum
  TextMessage, BinaryMessage, Ping, Pong
Source   Edit  
WebSocket = ref object
  
Source   Edit  

Procs

proc close(ws: WebSocket) {....raises: [], tags: [RootEffect], forbids: [].}
Source   Edit  
proc newWebSocket(url: string): WebSocket {....raises: [CatchableError, ValueError,
    HttpRequestError, LibraryError, Exception, OSError, SslError, IOError,
    TimeoutError, ProtocolError, KeyError],
    tags: [RootEffect, ReadIOEffect, WriteIOEffect, TimeEffect], forbids: [].}
Opens a new WebSocket connection. Source   Edit  
proc receiveMessage(ws: WebSocket; timeout = -1): Option[Message] {....gcsafe,
    raises: [CatchableError, OSError, SslError, TimeoutError],
    tags: [ReadIOEffect, TimeEffect], forbids: [].}
Source   Edit  
proc send(ws: WebSocket; data: sink string; kind = TextMessage) {....gcsafe,
    raises: [SslError, OSError, CatchableError], tags: [WriteIOEffect],
    forbids: [].}
Source   Edit