20 lines
537 B
JavaScript
20 lines
537 B
JavaScript
import Channel from "../channel.js";
|
|
export default class extends Channel {
|
|
chName = "shogi";
|
|
static shouldShare = true;
|
|
static requireCredential = true;
|
|
constructor(id, connection){
|
|
super(id, connection);
|
|
this.onEvent = this.onEvent.bind(this);
|
|
}
|
|
async init(params) {
|
|
this.subscriber.on(`shogiStream:${this.user.id}`, this.onEvent);
|
|
}
|
|
onEvent(data) {
|
|
this.send(data);
|
|
}
|
|
dispose() {
|
|
this.subscriber.off(`shogiStream:${this.user.id}`, this.onEvent);
|
|
}
|
|
}
|