1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33---
name: Feature implementation
about: A new awesome feature
title: ""
labels: "enhancement"
assignees: ""
---
Related issue or discussion:
**New behavior**
```ts
import { Server } from "https://deno.land/x/socket_io@x.y.z/mod.ts";
const io = new Server();
io.on("connection", (socket) => {
console.log(`socket ${socket.id} connected`);
socket.emit("hello", "world");
socket.on("disconnect", (reason) => {
console.log(`socket ${socket.id} disconnected due to ${reason}`);
});
});
Deno.serve({
handler: io.handler(),
port: 3000,
});
```