Last active
July 23, 2017 14:03
-
-
Save mikesurowiec/f1b07a91a9e7734942b9fa90646d9739 to your computer and use it in GitHub Desktop.
Shows how socket acts like a more standard REST api, with request / response
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Allows the client to get the data without having to wait for a new REQUEST_INTERVAL. | |
socket.on('getRealtimeDataForStations', (stations) => { | |
if (datastore.realtime && Array.isArray(stations)) { | |
stations.forEach((locationCode) => { | |
socket.emit(`realtime/${locationCode}`, datastore.realtime[locationCode]); | |
}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment