Skip to content

Commit

Permalink
docs(examples): update TypeScript example
Browse files Browse the repository at this point in the history
  • Loading branch information
darrachequesne committed Oct 27, 2020
1 parent cacad70 commit 64056d6
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 49 deletions.
4 changes: 1 addition & 3 deletions examples/typescript/client.ts
@@ -1,14 +1,12 @@
import { Manager } from "socket.io-client";

const manager = new Manager("ws://localhost:8080", {});
const manager = new Manager("ws://localhost:8080");
const socket = manager.socket("/");

// @ts-ignore
socket.on("connect", () => {
console.log(`connect ${socket.id}`);
});

// @ts-ignore
socket.on("disconnect", () => {
console.log(`disconnect`);
});
Expand Down
67 changes: 23 additions & 44 deletions examples/typescript/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions examples/typescript/server.ts
@@ -1,8 +1,8 @@
import { Server } from "socket.io";
import { Server, Socket } from "socket.io";

const io = new Server(8080);

io.on("connect", (socket) => {
io.on("connect", (socket: Socket) => {
console.log(`connect ${socket.id}`);

socket.on("ping", (cb) => {
Expand Down

0 comments on commit 64056d6

Please sign in to comment.