|
|
%!s(int64=11) %!d(string=hace) años | |
|---|---|---|
| .. | ||
| public | %!s(int64=11) %!d(string=hace) años | |
| .gitignore | %!s(int64=11) %!d(string=hace) años | |
| README.md | %!s(int64=11) %!d(string=hace) años | |
| archiver.js | %!s(int64=11) %!d(string=hace) años | |
| package.json | %!s(int64=11) %!d(string=hace) años | |
| server.js | %!s(int64=11) %!d(string=hace) años | |
a simple, web-based chat server using websockets.
$ npm install
$ PORT=10001 node server
The server is now running on http://localhost:10001.
You can also archive all messages ever sent:
$ HOST_URL=ws://localhost:10001 node archiver
This allows clients to load the previous messages on initial load.
here are some ideas how the api could look.
// client-side
var chat = document.querySelector("#chat");
babl.on('connection', function(conn) {
conn.on('message', function(msg) {
var display_msg = msg.user + "(" + msg.timestamp + "): " + msg.text;
chat.textContent += display_msg + "\n";
});
});