-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Setting up live tweet details over websockets.
- Loading branch information
James Thomas
committed
Mar 16, 2016
1 parent
bc24e75
commit 70f4b96
Showing
13 changed files
with
7,733 additions
and
6 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import io from 'socket.io-client' | ||
class WebSocket { | ||
constructor () { | ||
this.socket = io() | ||
this.topic = 'updates' | ||
this.socket.on('connect', () => { | ||
console.log('listening to updates'); | ||
}) | ||
this.socket.on('disconnect', () => { | ||
console.log('disconnected from updates') | ||
}) | ||
} | ||
|
||
listen () { | ||
this.socket.on(this.topic, this.listener) | ||
} | ||
|
||
ignore () { | ||
this.socket.removeListener(this.listener) | ||
} | ||
|
||
listener (msg) { | ||
console.log(msg) | ||
} | ||
} | ||
|
||
const websocket = new WebSocket() | ||
|
||
export default websocket |
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
Oops, something went wrong.