Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🗿 Added a real-time Dashboard with Socket.io #23

Closed
wants to merge 1 commit into from
Closed

🗿 Added a real-time Dashboard with Socket.io #23

wants to merge 1 commit into from

Conversation

dstroot
Copy link

@dstroot dstroot commented Jan 29, 2014

Thought this project would be more fun/interesting with a real-time dashboard driven by socket.io.

I created a new dashboard page that shows real-time connections and browsing activity. Typically this would be in an admin-type area of the app.

I know this clutters the example a bit so you may not want to accept this but it's pretty cool. No worries if you don't want to merge it.

@sahat
Copy link
Owner

sahat commented Jan 30, 2014

Hi dstroot, thank you for your pull request. I have written a detailed explanation in the guide section on how to use socket.io with hackathon starter as to why this cannot be part of the project. That section explains everything one needs to get started with socket.io. I used your committed code as a reference, with slight modifications to make things simple, so not to overwhelm beginners with all that production optimization stuff.

I have taken a few things from your code and merged it with master:

  • development or production mode message when you start the server.
  • use friendlier time, e.g. day, hour, week, month for caching maxAge.
  • var socket = io.connect(window.location.href);. This is really nice, since most examples on the web use hard-coded URLs which becomes a problem when you are developing on localhost and then deploy your app.

@sahat sahat closed this Jan 30, 2014
@sixFingers
Copy link
Contributor

I would also suggest to present Sockjs as a valid (i would say, preferable) alternative to Socket.io.

@dstroot
Copy link
Author

dstroot commented Jan 30, 2014

Sahat - I like how you documented this in the readme - very cool!

@sahat
Copy link
Owner

sahat commented Jan 31, 2014

@sixFingers I have not heard of Sockjs until you mentioned it. It's just socket.io seems to be the de facto library for doing websockets in Node. Can it do something that socket.io cannot do? From learning perspective I would imagine socket.io would be easier to learn for beginners due to large number of available tutorials, screencasts, guides on the topic.

@dstroot Thanks!

@sixFingers
Copy link
Contributor

@sahat this is a good explanation of the differences: http://xsnippet.org/359042/
From my personal experience, Socket.io is more feature-packed, but less reliable than Sockjs.
Sockjs also can count on a good number of extensions (ex: for events, there's https://github.com/epixa/chuckt). Just my two cents :)

@bcldvd
Copy link

bcldvd commented Feb 14, 2014

First of all, thanks to both sahat and dstroot for your wonderfull work :)

Just some correction in the readme, you forgot to add this change :

app.listen(app.get('port'), function() {

to

server.listen(app.get('port'), function() {

Without this, socket.io.js is not found :/

@sahat
Copy link
Owner

sahat commented Feb 17, 2014

@bcldvd Thanks! I have it as server.listen() at http://hackathonstarter.herokuapp.com demo code but forgot to add it in the README. The socket.io guide should be updated now.

deadcoder0904 added a commit to deadcoder0904/hackathon-starter that referenced this pull request Oct 2, 2016
Line sahat#22 & sahat#23 changed to serve jQuery & Bootstrap as CDN's are made to serve contents fast
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants