Skip to content

Commit 993e491

Browse files
committedApr 22, 2016
Merge pull request #3 from NovusTheory/lua-wss
WSS Support
2 parents 53107b3 + 49edb25 commit 993e491

File tree

3 files changed

+4
-10
lines changed

3 files changed

+4
-10
lines changed
 

‎README.md

+1
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ The client and server modules depend on:
116116

117117
- luasocket
118118
- luabitop (if not using Lua 5.2 nor luajit)
119+
- luasec
119120
- copas (optionally)
120121
- lua-ev (optionally)
121122

‎src/websocket/client_sync.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ local new = function(ws)
2727
end
2828

2929
self.sock_close = function(self)
30-
self.sock:shutdown()
30+
--self.sock:shutdown() Causes errors?
3131
self.sock:close()
3232
end
3333

‎src/websocket/sync.lua

+2-9
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ local ssl = require'ssl'
55
local tinsert = table.insert
66
local tconcat = table.concat
77

8-
98
local receive = function(self)
109
if self.state ~= 'OPEN' and not self.is_closing then
1110
return nil,nil,false,1006,'wrong state'
@@ -118,7 +117,7 @@ local close = function(self,code,reason)
118117
return was_clean,code,reason or ''
119118
end
120119

121-
local connect = function(self,ws_url,ws_protocol)
120+
local connect = function(self,ws_url,ssl_params,ws_protocol)
122121
if self.state ~= 'CLOSED' then
123122
return nil,'wrong state'
124123
end
@@ -129,13 +128,7 @@ local connect = function(self,ws_url,ws_protocol)
129128
return nil,err
130129
end
131130
if protocol == 'wss' then
132-
local params = {
133-
mode = "client",
134-
protocol = "sslv23",
135-
verify = "none",
136-
options = {"all"}
137-
}
138-
self.sock = ssl.wrap(self.sock, params)
131+
self.sock = ssl.wrap(self.sock, ssl_params)
139132
self.sock:dohandshake()
140133
elseif protocol ~= "ws" then
141134
return nil, 'bad protocol'

0 commit comments

Comments
 (0)
Please sign in to comment.