diff --git a/examples/simplewebsocket.lua b/examples/simplewebsocket.lua index fe46d5bf..99848209 100755 --- a/examples/simplewebsocket.lua +++ b/examples/simplewebsocket.lua @@ -43,7 +43,10 @@ if MODE == "agent" then skynet.start(function () skynet.dispatch("lua", function (_,_, id, protocol, addr) - websocket.accept(id, handle, protocol, addr) + local ok, err = websocket.accept(id, handle, protocol, addr) + if not ok then + print(err) + end end) end) diff --git a/lualib/http/websocket.lua b/lualib/http/websocket.lua index 49947109..bfecdbe6 100755 --- a/lualib/http/websocket.lua +++ b/lualib/http/websocket.lua @@ -407,9 +407,11 @@ function M.accept(socket_id, handle, protocol, addr) try_handle(ws_obj, "error") end else - error(err) + -- error(err) + return false, err end end + return true end