Created
June 20, 2021 12:37
-
-
Save teyfix/62fd3d8a6685d6b15c4b0439239fccd0 to your computer and use it in GitHub Desktop.
rxjs - simple socket.io
This file contains hidden or 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
| import { fromEvent } from 'rxjs'; | |
| import io from 'socket.io-client'; | |
| const client = io().connect(); | |
| const listen = (event: string) => fromEvent(client, event); | |
| listen('message').subscribe((message) => console.log(message)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment