Search Results

Search found 2 results on 1 pages for 'user730569'.

Page 1/1 | 1 

  • How to efficiently deal with a large amount of HTML5 canvas pixel data over websockets

    - by user730569
    Using imageData = context.getImageData(0, 0, width, height); JSON.stringify(imageData.data); I grab the pixel data, convert it to a string, and then send it over the wire via websockets. However, this string can be pretty large, depending on the size of the canvas object. I tried using the compression technique found here: JavaScript implementation of Gzip but socket.io throws the error Websocket message contains invalid character(s). Is there an effective way to compress this data so that it can be sent over websockets?

    Read the article

  • Specifying routes by subdomain in Express using vhost middleware

    - by user730569
    I'm using the vhost express/connect middleware and I'm a bit confused as to how it should be used. I want to have one set of routes apply to hosts with subdomains, and another set to apply for hosts without subdomains. In my app.js file, I have var app = express.createServer(); app.use...(middlware)... app.use(express.vhost('*.host', require('./domain_routing')("yes")); app.use(express.vhost('host', require('./domain_routing')("no")); app.use...(middlware)... app.listen(8000); and then in domain_routing.js: module.exports = function(subdomain){ var app = express.createServer(); require('./routes')(app, subdomain); return app; } and then in routes.js I plan to run sets of routes, dependent on the subdomain variable passed in is "yes" or "no". Am I on the right track or is this not how you use this middleware?

    Read the article

1