Skip to content

websocket: attempt to yield across C-call boundary #5

@ghost

Description

Writing to a websocket from a timer-callback fails:

local weblit = require("weblit")
local timer = require("timer")

weblit.app
.bind({host = "127.0.0.1", port = 1337})
.use(weblit.logger)
.use(weblit.autoHeaders)
.use(weblit.websocket({path = '/ws', host = '127.0.0.1'}, function(req, read, write)
  for thing in read do
      p(thing)
      timer.setTimeout(1000, function()
          print("timeout")
          write({opcode = 1; payload = "websocket-hello"})
      end)
  end
  write()
end))
.start()

...the same happens if I try to write to a websocket from a childprocess's on('exit') callback

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions