21 lines
464 B
TypeScript
21 lines
464 B
TypeScript
|
import { WebSocket } from "ws";
|
||
|
|
||
|
export default class User {
|
||
|
private static USER_IDS = 0;
|
||
|
|
||
|
private readonly socket:WebSocket;
|
||
|
public readonly id:number;
|
||
|
public readonly username:string;
|
||
|
public readonly currentURL:string;
|
||
|
|
||
|
constructor(socket:WebSocket, username:string, currentURL:string) {
|
||
|
this.socket = socket;
|
||
|
this.id = User.USER_IDS++;
|
||
|
this.username = username;
|
||
|
this.currentURL = currentURL;
|
||
|
}
|
||
|
|
||
|
send(data:Buffer) {
|
||
|
this.socket.send(data);
|
||
|
}
|
||
|
}
|