-
Notifications
You must be signed in to change notification settings - Fork 44
Open
Description
Example ported to connect 3, issue may be within connect library?
chat.html:
socket = new BCSocket('/channel');
socket.onopen = function() {
socket.send({hi:'there'});
socket.close();
};
chat.js:
var connect = require('connect');
var http = require('http');
var browserChannel = require('browserchannel').server;
var serveStatic = require('serve-static');
var app = connect();
app.use(serveStatic(__dirname));
app.use(browserChannel(function (session) {
console.log('New session: ' + session.id +
' from ' + session.address +
' with cookies ' + session.headers.cookie);
session.on('message', function (data) {
console.log(session.id + ' sent ' + JSON.stringify(data));
session.send(data);
});
etc
socket.close() in chat.html needs to be commented out for hi:"there" message to get through.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels