You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This code works perfectly but i don't have access to the variable 'req', so I did like it is specified in the documentation but I am probably wrong with my implementation:
Server:
var express = require('express');
var app = express();
var BinaryServer = require('binaryjs').BinaryServer;
app.listen(8080);
var bs = new BinaryServer({port: 9000});
function request(client, meta) {
console.log("request");
}
function upload(stream, meta) {
console.log("upload");
stream.write({ end: true });
}
app.get('/binary-endpoint', function(req, res) {
console.log("get");
});
app.post('/binary-endpoint', function(req, res) {
console.log("post");
});
bs.on('connection', function (client) {
client.on('stream', function (stream, meta) {
switch(meta.event) {
case 'stream':
request(client, meta);
break;
case 'upload':
upload(stream, meta);
}
});
});
console.log('The magic happens on port ' + port);
Just this line changes in the client:
var client = new BinaryClient('ws://' + hostname + ':8080/binary-endpoint');
But nothing happen in the server, no log is diplayed and I get this message in the client console:
GET http://127.0.0.1/upload.html [HTTP/1.1 304 Not Modified 1ms]
GET http://cdn.binaryjs.com/0/binary.js [HTTP/1.1 304 Not Modified 102ms]
GET http://code.jquery.com/jquery-1.11.0.min.js [HTTP/1.1 304 Not Modified 26ms]
GET http://code.jquery.com/jquery-migrate-1.2.1.min.js [HTTP/1.1 304 Not Modified 48ms]
GET http://5.135.163.236:8080/binary-endpoint [168ms]
Firefox can't establish a connection to the server at ws://5.135.163.236:8080/binary-endpoint. binary.js:1341
GET http://null/ [2252ms]
Error: Client is not yet connected or has closed binary.js:1539
Firefox can't establish a connection to the server at ws://null/.
Thanks for your help
The text was updated successfully, but these errors were encountered:
Hello,
I need to get the variable 'req' with a requete to the BinaryJS server.
First I split the ExpressJS server and the BinaryJS server:
Server:
Client:
This code works perfectly but i don't have access to the variable 'req', so I did like it is specified in the documentation but I am probably wrong with my implementation:
Server:
Just this line changes in the client:
But nothing happen in the server, no log is diplayed and I get this message in the client console:
Thanks for your help
The text was updated successfully, but these errors were encountered: