-
-
Save urish/4a79ad2a48ad68ae6cac6bd0bc4e881c to your computer and use it in GitHub Desktop.
Firebase Proxy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// To use: npm install ws | |
'use strict'; | |
var WebSocket = require('ws'); | |
var WebSocketServer = WebSocket.Server; | |
var wss = new WebSocketServer({port: 5000}); | |
wss.on('connection', function (ws) { | |
var clientWs = new WebSocket('wss://s-dal5-nss-22.firebaseio.com/.ws?v=5&ns=firebase-name', {protocolVersion: 8, origin: 'http://localhost'}); | |
clientWs.on('message', function(data) { | |
console.log('server', data); | |
ws.send(data); | |
}); | |
ws.on('message', function(data) { | |
console.log('client', data); | |
clientWs.send(data); | |
}); | |
console.log('conn'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment