Better P2P (Easy Remote Access v2)+

socket.io-v4
Moe 2022-03-28 17:48:08 -07:00
parent c28b246ac4
commit 25fddb7ba5
1 changed files with 5 additions and 5 deletions

View File

@ -37,9 +37,9 @@ function startConnection(p2pServerAddress,subscriptionId){
const allMessageHandlers = [] const allMessageHandlers = []
function startWebsocketConnection(key,callback){ function startWebsocketConnection(key,callback){
function disconnectedConnection(code,reason){ function disconnectedConnection(code,reason){
console.log('stayDisconnected',stayDisconnected) s.debugLog('stayDisconnected',stayDisconnected)
if(stayDisconnected)return; if(stayDisconnected)return;
console.log('DISCONNECTED! RESTARTING!') s.debugLog('DISCONNECTED! RESTARTING!')
setTimeout(() => { setTimeout(() => {
startWebsocketConnection() startWebsocketConnection()
},2000) },2000)
@ -49,7 +49,7 @@ function startConnection(p2pServerAddress,subscriptionId){
}catch(err){ }catch(err){
console.log(err) console.log(err)
} }
console.log(p2pServerAddress) s.debugLog(p2pServerAddress)
tunnelToShinobi = new WebSocket(p2pServerAddress || 'ws://172.16.101.218:81'); tunnelToShinobi = new WebSocket(p2pServerAddress || 'ws://172.16.101.218:81');
tunnelToShinobi.on('open', function(){ tunnelToShinobi.on('open', function(){
@ -126,10 +126,10 @@ function startConnection(p2pServerAddress,subscriptionId){
// const hostParts = data.host.split(':') // const hostParts = data.host.split(':')
// const host = hostParts[0] // const host = hostParts[0]
// const port = parseInt(hostParts[1]) || 80 // const port = parseInt(hostParts[1]) || 80
console.log('New Request Incoming', null, null, requestId) s.debugLog('New Request Incoming', null, null, requestId)
const socket = createRemoteSocket(null, null, requestId) const socket = createRemoteSocket(null, null, requestId)
socket.on('ready',() => { socket.on('ready',() => {
console.log('READY') s.debugLog('READY')
writeToServer(data.init,requestId) writeToServer(data.init,requestId)
}) })
}) })