Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var socket = io();
- console.log(socket);
- n {io: n, nsp: "/", json: n, ids: 812, acks: {…}, …}
- acks: {840: ƒ, 841: ƒ, 842: ƒ, 843: ƒ, 844: ƒ, 845: ƒ, 846: ƒ, 847: ƒ, 848: ƒ, 849: ƒ, 850: ƒ, 851: ƒ}
- connected: true
- disconnected: false
- id: "ucS-fRqvhc_3OlYZAAAC"
- ids: 852
- io: n {nsps: {…}, subs: Array(6), opts: {…}, _reconnection: true, _reconnectionAttempts: Infinity, …}
- json: n {io: n, nsp: "/", json: n, ids: 852, acks: {…}, …}
- nsp: "/"
- receiveBuffer: []
- sendBuffer: []
- subs: (3) [{…}, {…}, {…}]
- _callbacks: {$connecting: Array(1), $connect: Array(1), $update: Array(1), $dialogo-servidor-usuarios: Array(1), $simon-says: Array(1)}
- __proto__: Object
- socket.disconnect();
- socket.on('disconnect', function() {
- //socket.reconnect();
- //buscamos el nombre del usuario por el id del sock
- var player = game.all_player_info(socket.id);
- if (player != null) {
- //revisamos
- console.log(player);
- //armamos el pedido
- req = API_URI;
- req += '?model=user/close';
- req += '&username=';
- req += player.name;
- //no usamos el password del usuario, sino el de la aplicación.
- req += '&password='
- req += player.pass;
- //lo marcamos offline de nuevo.
- request(req, { json: true }, (err, res, body) => {
- //en caso de error de comunicación
- if (err) { return console.log(err); }
- //feedback de API
- console.log(body);
- });
- //hacemos el player quede en campo 10 segundos de espera
- setTimeout( function() {
- //cuando pasen 5'
- console.log(req);
- //removemos la unidad
- game.removePlayer(socket.id);
- }, 8000 );
- }
- });
- io: n
- autoConnect: true
- backoff: r {ms: 1000, max: 5000, factor: 2, jitter: 0.5, attempts: 0}
- connecting: [n]
- decoder: s {reconstructor: null, _callbacks: {…}}
- encoder: n {}
- encoding: false
- engine: n {secure: true, agent: false, hostname: "127.0.0.1", port: "443", query: {…}, …}
- lastPing: Sun Sep 30 2018 12:35:16 GMT-0300 (hora estándar de Argentina) {}
- nsps: {/: n}
- opts: {path: "/socket.io", hostname: "127.0.0.1", secure: true, port: "443"}
- packetBuffer: []
- readyState: "open"
- skipReconnect: false
- subs: (6) [{…}, {…}, {…}, {…}, {…}, {…}]
- uri: "https://127.0.0.1"
- _callbacks: {$open: Array(1), $packet: Array(1), $close: Array(1)}
- _randomizationFactor: 0.5
- _reconnection: true
- _reconnectionAttempts: Infinity
- _reconnectionDelay: 1000
- _reconnectionDelayMax: 5000
- _timeout: 20000
- socket.emit('respawn');
Add Comment
Please, Sign In to add comment