lipp / lua-websockets

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

New backend #49

Open moteus opened 9 years ago

moteus commented 9 years ago

I just imlement new backend for lua-websocket based on my libuv binding. For now it implement same API as ev backend. And I have several question: 1 To be avaliable you need add optional require to client/server files in main repo? (I have no objection to just merge my reto to this repo) 2 No all Linstners share same client set (clients table). Is it intentional or better if each server will have its own set? 3 To support wss protocol is it enough just make TLS connection?

lipp commented 9 years ago

great :100: ! nice work! i am looking forward to integrate that!!!

1) maybe you could make a fork, add your new backend and make a PR? this would make communication much simpler. 2) that is intentionally, since the clients are related to each server instance. 3) I am not sure. This is maybe a https thing to look up. Other impl don't support secure cons for some reason: I really like Lua, but if you have the resources, users might just use a fullsize env like node.js or whatever. What do you think? Do you have wss scenarios?

There are some minor style things I'd like to keep homogenous. Tests are required too (this may require add lluv support for busted 1.11.1 - I can do that).

moteus commented 9 years ago

maybe you could make a fork, add your new backend and make a PR?

Checkout #50

that is intentionally, since the clients are related to each server instance

OK. But in your code has problem when you start several servers in one process. But it rare. You fill clients table when start server and this may override existed clients that alreade there from other server. I think I make this optioanal.

I am not sure. This is maybe a https thing to look up. Other impl don't support secure cons for some >reason: I really like Lua, but if you have the resources, users might just use a fullsize env like node.js or >whatever. What do you think? Do you have wss scenarios?

I need only server without wss. But if for wss needs only TLS connection and because it quite easy do I implement this one for client https://github.com/moteus/lua-websockets-lluv/commit/9d8767d2ce3cfb9907b7cd4e406fdac474f2cbfd that works with `"wss://echo.websocket.org". I realy do not know anything about wss but since it works I think it valid. Server side is also simple as is.

Tests are required too (this may require add lluv support for busted 1.11.1 - I can do that).

I will be very appreciate because I never use busted.

lipp commented 9 years ago

i'll extend busted to support lluv.

lipp commented 9 years ago

making progress on that. unfortunately the debug traceback (coxpcall) is not available when employing lluv. this is required for busted to correctly report errors.

   local trace
   local ok, err = suite.loop.xpcall(
      function()
        this_test.f(wrap_done(done))
      end,
      function(err)
        trace = debug.traceback("", 2)
         -- trace is nil using lluv !!!
        return err
     end)
lipp commented 9 years ago

added a workaround ... as long as you dont want lluv officially supported by busted, no prob for me. please try to add test using this busted version:

git clone https://github.com/lipp/busted/tree/1.11.1-uvll-support
cd 1.11.1-uvll-support
./try

this will install busted with lluv support. The test should prob look pretty much the ev_client/ev_server tests. You must call setloop('lluv') just like here https://github.com/lipp/lua-websockets/blob/master/spec/server_ev_spec.lua#L9.

moteus commented 8 years ago

I decide to release my version. I did not use it in real life yet but It pass all autobahn tests (except some related with fast fall). It support WSS and IPv6. I implement test-server and basic echo client

I decide copy some files from your repo (because I make some changes to them and also because there no rockspec only for core and I do not add deps from all other lua-websockets deps like lua-ev etc)

You may be interested with my bit.lua file. It implement bit32 library for Lua 5.3 based on bit operators. Also I use

lipp commented 8 years ago

great! thanks for keeping me updated! The bit stuff for lua 5.3 could be very interesting for soon. sorry I wasnt so focused on lua-websockets lately. Unfortunately time is running very short with kids :) .