Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.






                var exp = require('express')();
var http = require('http').Server(exp)
var io = require('')(http)

// Serve index.html
exp.get('/', function(req, res){
    res.sendFile(__dirname + '/index.html');

// Set the listening port to 4321
http.listen(4321, function(){
    console.log('Server is listening on *:4321')

// Socket.IO implementation
io.on('connection', function(socket) {
    console.log('New user!')

    socket.on('set_username', function(msg) {
        console.log('Username set:', msg.username)
        socket.Name = msg.username
        // Let everyone else know that a new user has entered the chat
        socket.broadcast.emit('message', { name: null, txt: socket.Name + ' has entered the chat!' })

    socket.on('message', function(msg) {
        console.log('New message:', socket.Name, msg.msg)
        // Emit the message to everyone except the user who sent it
        socket.broadcast.emit('message', { name: socket.Name, txt: msg.msg })

    socket.on('disconnect', function() {
        console.log('User disconnected...', socket.Name)
        // Let everyone else know that a new user has left the chat
        io.emit('message', { name: null, txt: socket.Name + ' has left the chat!' })