-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
melike2d
committed
Aug 12, 2021
1 parent
ed666e9
commit 4106f1f
Showing
1 changed file
with
24 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# PogSocket | ||
|
||
> Deno websocket client (based on the original deno websocket client). | ||
## Usage | ||
|
||
**Connecting to Echo Server** | ||
|
||
```ts | ||
import { connectPogSocket, readSocket, sendMessage } from "https://deno.land/x/pogsocket/mod.ts"; | ||
|
||
const socket = await connectPogSocket("ws://localhost:3030"); | ||
setInterval(() => sendMessage(socket, "hello me!"), 2000); | ||
|
||
for await (const event of readSocket(socket)) { | ||
if (event.type === "message") { | ||
console.log(event.message); | ||
} | ||
} | ||
``` | ||
|
||
--- | ||
|
||
[melike2d](https://dimensional.fun) |