#sockets

1 bookmarks tagged with #sockets · RSS Feed · ← All Tags

Real-Time Chat With Node.js' Readline & Socket.io - Tuts+ Code Tutorial

http://code.tutsplus.com/tutorials/real-time-chat-with-nodejs-readline-socketio--cms-20953
Node.js has an under-appreciated module in its standard library that is surprisingly useful. The Readline module does what it says on the box: it reads a line of input from the terminal. This can be used to ask the user a question or two, or to create a prompt at the bottom of the screen. In this tutorial, I intend to show off the capability of Readline and make a real-time CLI chatroom backed by Socket.io. The client will not only send simple messages, but have commands for emotes with /me, private messages with /msg, and allow for nicknames to be changed with /nick.