websocketlogin.js 488 B

1234567891011121314151617181920212223242526272829
  1. module.exports = class WebsocketLogin {
  2. constructor(socket) {
  3. this.socket = socket;
  4. this.player = new world.Player();
  5. }
  6. attach() {
  7. this.player.socket = this.socket;
  8. core.attachPlayer(this.player);
  9. }
  10. receive(data) {
  11. core.handleInput(this.player, data);
  12. }
  13. disconnect() {
  14. core.removePlayer(this.player);
  15. }
  16. setConnectionTimeout(time) {
  17. console.log("gotta handle connection timeout");
  18. //this.socket.setTimeout(time);
  19. }
  20. logout() {
  21. this.socket.close();
  22. }
  23. };