Just in case someone stumbles over this thread: I had to make some slight 
changes for this to work again:
    
    
    import std/[
        net,
        strformat,
        strutils
    ]
    
    const
        host = "lichess.org"
        token = "wn89m89uer8999e9"
    
    let s = newSocket()
    wrapSocket(newContext(), s)
    s.connect(host, Port(443))
    
    let req = &"GET /api/stream/event HTTP/1.1\r\nHost: 
{host}\r\nAuthorization: Bearer {token}\r\nAccept: x-ndjson\r\n\r\n"
    echo req
    
    s.send(req)
    while true:
        let line = s.recvLine
        if line.strip.len > 0 and line.strip[0] == '{':
            echo line
    
    
    Run

Reply via email to