Skip to content

wss client connect error #103

Description

@mxinglee

function testSSL()
local client = ws.client.sync({timeout=2})
local ok,err = client:connect("wss://echo.websocket.org/")
if not ok then
const.debug_print('could not connect', err);
end
local ok = client:send("Hello, World");
if ok then
print('msg sent')
else
print('connection closed')
end
local message,opcode = client:receive()
if message then
print('msg',message,opcode)
else
print('connection closed')
end
client:close()
end
testSSL()

------------------the error -------------------------------
lua: /usr/local/share/lua/5.1/ssl.lua:120: bad argument #1 to 'create' (SSL:Context expected, got nil)
stack traceback:
[C]: in function 'create'
/usr/local/share/lua/5.1/ssl.lua:120: in function 'wrap'
./websocket/sync.lua:131: in function 'connect'
websockHandle.lua:99: in function 'testSSL'
websockHandle.lua:122: in main chunk
[C]: ?


If I use ws client the function works right, what's the problem?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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