lipp / lua-websockets

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

lua-websockets can run with lua 5.3? #84

Open feihuroger opened 8 years ago

feihuroger commented 8 years ago

I have to build with 5.3, need to change bitopt to bit32, another question is Copas just for lua 5.1, 5.2. websocket.client.copas is error.

lipp commented 8 years ago

By requiring single modules you can circumvent auto require copas. e.g. require('websockets.client_ev')

PRs welcome :+1:

ntd commented 8 years ago

copas supports Lua 5.3 since 2.0.1. No PRs needed, at least not for copas :wink:

The module that creates problem seems to be luabitop. It would be great if we can conditionally drop that dependency for Lua > 5.1.

I can take a look at it when I will need 5.3 support, but this will take a couple of months.

RussellHaley commented 8 years ago

I just bumped into this issue. I guess I'll subscribe to this thread. Thanks.

RussellHaley commented 7 years ago

Hi there, I'm still stuck on this. Can anyone help? I was told 5.3 shouldn't need luabitop?

moteus commented 7 years ago

I think for now it does not suppurt bit operations on Lua 5.3. And because there no bit32 module I suggest use bit32 from luarocks. It works fine on Lua 5.3. Or you can make PR to add support this. :)

RussellHaley commented 7 years ago

Would replacing bit.lua with this help?

https://github.com/daurnimator/lua-http/blob/master/http/bit.lua

moteus commented 7 years ago

You also need shift operations. Checkou my variant. https://github.com/moteus/lua-lluv-websocket/blob/master/src/lluv/websocket/bit.lua

FrankBuchholz commented 4 years ago

I tried to use Lua 5.3 in the x64-Version but failed, too:

  1. I could solve the issue about bit.lua by creating my own (incomplete) file which basically wraps built-in operators from Lua 5.3 into functions:: return { band = function(a, b) return a & b end; bor = function(a, b) return a | b end; bxor = function(a, b) return a ~ b end; bnot = function(x) return ~ x end; lshift = function(x, n) return x << n end; rshift = function(x, n) return x >> n end; arshift = function(x, n) print('arshift missing') return x end; rol = function(x, n) return (x<<(n%64))|(x>>(64-(n%64))) end; ror = function(x, n) return (x>>(n%64))|(x<<(64-(n%64))) end; bswap = function(x) print('bswap missing') return x end; }

  2. However, this is not sufficient : The client of the test-server-copas.lua still reports the error "Error during WebSocket handshake: Incorrect 'Sec-WebSocket-Accept' header value"

Now I'm looking for different libraries like https://github.com/daurnimator/lua-http

robertlzj commented 2 years ago

For bitop, there is a fork from https://github.com/LuaDist/luabitop, which support Lua 5.3 (and provide bit.dll etc). (And there is more forks from original luabitop)

But with further test, I get error attempt to call a nil value (global 'unpack') at 'websocket\frame.lua', so means there is old incompatible Lua function. Seems its easy to convert/update.. Replace unpack to table.unpack.

@FrankBuchholz Thank you for introduce https://github.com/daurnimator/lua-http (Dependency doesn't support Microsoft Windows operating systems).