mirror of
https://github.com/raz-varren/sacrificial-socket.git
synced 2025-10-06 16:46:56 +08:00
replaced golang.org/x/net websockets with github.com/gorilla websockets
This commit is contained in:
@@ -34,7 +34,8 @@ if(typeof module === 'undefined'){
|
||||
headerStartChar = String.fromCharCode(headerStartCharCode),
|
||||
dataStartCharCode = 2,
|
||||
dataStartChar = String.fromCharCode(dataStartCharCode),
|
||||
ws = new WebSocket(url, 'sac-sock');
|
||||
subProtocol = 'sac-sock',
|
||||
ws = new WebSocket(url, subProtocol);
|
||||
|
||||
//blomp blomp-a noop noop a-noop noop noop
|
||||
self.noop = function(){ };
|
||||
@@ -112,7 +113,7 @@ if(typeof module === 'undefined'){
|
||||
function startReconnect(){
|
||||
setTimeout(function(){
|
||||
console.log('attempting reconnect');
|
||||
var newWS = new WebSocket(url, 'sac-sock');
|
||||
var newWS = new WebSocket(url, subProtocol);
|
||||
newWS.onmessage = ws.onmessage;
|
||||
newWS.onclose = ws.onclose;
|
||||
newWS.binaryType = ws.binaryType;
|
||||
@@ -240,7 +241,7 @@ if(typeof module === 'undefined'){
|
||||
*/
|
||||
self.close = function(){
|
||||
reconnectOpts.enabled = false; //don't reconnect if close is called
|
||||
return ws.close();
|
||||
return ws.close(1000);
|
||||
};
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user