• images
  • 2:55 pm
  • images
  • No Comments.

SocketCluster Chat Demo

Warning: file_get_contents(http://www.linkedin.com/countserv/count/share?url=https://azerothian.net/2016/08/27/socketcluster-chat-demo/&format=json): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /var/www/html/wp-content/plugins/tk-social-share/tk-social-counter.php on line 145

So i recently discovered socket cluster while browsing github, and I though it would be interesting to see as a react/websocket based chat demo. So using es6 i whipped up a simple demo and have published it on github and put up a demo.


https://chat.azerothian.net/ (you should also be able to interact with it on the bottom right hand of the web page)




  • So when you run socketcluster create myapp it generates a relatively complex server.js for providing defaults and processing arguments, this seems to be handy for targeting container based setups. But for a basic projects this seems to be an overkill, though I decided i wanted the best of both worlds 😉 e.g. /src/server/utils/scluster.js
  • The control on the bottom right is the same code as the https://chat.azerothian.net/ it just looks for a html element on the page and if it cant be found then it switches to overlay mode using position fixed.
  • While building for production I currently have a enforced variable for my socket cluster server /src/react-app/app.jsx#L33