lipp / lua-websockets

Websockets for Lua.
http://lipp.github.com/lua-websockets/
MIT License
396 stars 113 forks source link

WSS Support for Sync & Copas #91

Closed NovusTheory closed 8 years ago

NovusTheory commented 8 years ago

NOTE: You verify certificate yourself, via ssl_params

Okay, this is an extremely rough draft and probably will contain a lot bugs to admit, it was tested on an actual server and it seems to work fine.

I will probably start working on the other ones soon.

LuaSec dependency now required for WSS support.

If you have issues with WSS please tag me in them so I can be sure to look at them

NovusTheory commented 8 years ago

CI failed ;(

lipp commented 8 years ago

@NovusTheory thx! The CI must succeed though :( Did you try to run the docker env for testing locally?

NovusTheory commented 8 years ago

@lipp I'll run the stuff locally and try to get the CI to pass that way it can be added in

coveralls commented 8 years ago

Coverage Status

Coverage decreased (-0.2%) to 91.097% when pulling a7a52b7ca85202e54f7b553f1fa84edb970df666 on NovusTheory:master into 1ec1ac614af5fc894e4ddc13df80445bd6529b13 on lipp:master.

NovusTheory commented 8 years ago

@lipp Took me a pain to get this but here the CI passed

I'm done with travis for life

lipp commented 8 years ago

💯 awesome! thanks a lot! Indeed, setting up travis etc with lua and stuff is a pain. That's why I like node.js. So much better support / tooling!

NovusTheory commented 8 years ago

@lipp I did some testing with this code and I changed the title to respectively say Copas does work with this Pull Request also, I'm still working on ev though which seems to be giving me some issues

local websocket = require'websocket'
local client = websocket.client.copas()

local params = {
    mode = "client",
    protocol = "sslv23",
    verify = "none",
    options = {"all"}
}

local c = coroutine.create(function()
    client:connect('wss://echo.websocket.org','echo',params)
end)

while true do
    local alive = coroutine.resume(c)
    if not alive then
       break
    end
end

for i = 1, 10 do
    local echo = coroutine.create(function()
        client:send('Hello')
        print(client:receive())
    end)

    while true do
        local alive = coroutine.resume(echo) 
        if not alive then
            break
        end
    end
end