Speed up development with full-stack environments for every branch.

Learn More

Realtime Canvas [express and Node.js]

5844 Runs 9860 Views 1226 Copies

Playground for example at https://github.com/techpines/express.io/tree/master/examples/realtime-canvas

Saved

Saved

srfrnk 3

srfrnk
published 3 years ago

    express = require('express.io')
    app = express().http().io()
    
    // Broadcast all draw clicks.
    app.io.route('drawClick', function(req) {
        req.io.broadcast('draw', req.data)
    })
    
    // Send client html.
    app.get('/', function(req, res) {
        res.sendfile(__dirname + '/client.html')
    })
    
    app.listen(80)
    Please login/signup to get access to the terminal.

    Your session has timed out.

    Dismiss (the page may not function properly).