Skip to content

Commit

Permalink
chore: point towards the develop branch of the server
Browse files Browse the repository at this point in the history
The package-lock.json file is temporarily removed in order to include
the latest commits to the server and make the tests pass.
  • Loading branch information
darrachequesne committed Oct 6, 2020
1 parent 429846b commit f2f4a4c
Show file tree
Hide file tree
Showing 13 changed files with 1,530 additions and 12,334 deletions.
1 change: 0 additions & 1 deletion .gitignore
@@ -1,3 +1,2 @@
/node_modules
/coverage
build/
13 changes: 13 additions & 0 deletions build/index.d.ts
@@ -0,0 +1,13 @@
/**
* Protocol version.
*
* @api public
*/
export { protocol } from "socket.io-parser";
/**
* Expose constructors for standalone build.
*
* @api public
*/
export { Manager } from "./manager";
export { Socket } from "./socket";
81 changes: 81 additions & 0 deletions build/index.js
@@ -0,0 +1,81 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Socket = exports.Manager = exports.protocol = void 0;
const url_1 = require("./url");
const manager_1 = require("./manager");
const debug = require("debug")("socket.io-client");
/**
* Module exports.
*/
module.exports = exports = lookup;
/**
* Managers cache.
*/
const cache = (exports.managers = {});
/**
* Looks up an existing `Manager` for multiplexing.
* If the user summons:
*
* `io('http://localhost/a');`
* `io('http://localhost/b');`
*
* We reuse the existing instance based on same scheme/port/host,
* and we initialize sockets for each namespace.
*
* @api public
*/
function lookup(uri, opts) {
if (typeof uri === "object") {
opts = uri;
uri = undefined;
}
opts = opts || {};
const parsed = url_1.url(uri);
const source = parsed.source;
const id = parsed.id;
const path = parsed.path;
const sameNamespace = cache[id] && path in cache[id].nsps;
const newConnection = opts.forceNew ||
opts["force new connection"] ||
false === opts.multiplex ||
sameNamespace;
let io;
if (newConnection) {
debug("ignoring socket cache for %s", source);
io = new manager_1.Manager(source, opts);
}
else {
if (!cache[id]) {
debug("new io instance for %s", source);
cache[id] = new manager_1.Manager(source, opts);
}
io = cache[id];
}
if (parsed.query && !opts.query) {
opts.query = parsed.query;
}
return io.socket(parsed.path, opts);
}
/**
* Protocol version.
*
* @api public
*/
var socket_io_parser_1 = require("socket.io-parser");
Object.defineProperty(exports, "protocol", { enumerable: true, get: function () { return socket_io_parser_1.protocol; } });
/**
* `connect`.
*
* @param {String} uri
* @api public
*/
exports.connect = lookup;
/**
* Expose constructors for standalone build.
*
* @api public
*/
var manager_2 = require("./manager");
Object.defineProperty(exports, "Manager", { enumerable: true, get: function () { return manager_2.Manager; } });
var socket_1 = require("./socket");
Object.defineProperty(exports, "Socket", { enumerable: true, get: function () { return socket_1.Socket; } });
203 changes: 203 additions & 0 deletions build/manager.d.ts
@@ -0,0 +1,203 @@
import Emitter from "component-emitter";
export declare class Manager extends Emitter {
autoConnect: boolean;
readyState: "opening" | "open" | "closed";
reconnecting: boolean;
private readonly uri;
private readonly opts;
private nsps;
private subs;
private backoff;
private _reconnection;
private _reconnectionAttempts;
private _reconnectionDelay;
private _randomizationFactor;
private _reconnectionDelayMax;
private _timeout;
private connecting;
private lastPing;
private encoding;
private packetBuffer;
private encoder;
private decoder;
private engine;
private skipReconnect;
/**
* `Manager` constructor.
*
* @param {String} engine instance or engine uri/opts
* @param {Object} options
* @api public
*/
constructor(uri: any, opts: any);
/**
* Propagate given event to sockets and emit on `this`
*
* @api private
*/
emitAll(event: string, arg?: any): void;
/**
* Update `socket.id` of all sockets
*
* @api private
*/
updateSocketIds(): void;
/**
* generate `socket.id` for the given `nsp`
*
* @param {String} nsp
* @return {String}
* @api private
*/
generateId(nsp: any): string;
/**
* Sets the `reconnection` config.
*
* @param {Boolean} true/false if it should automatically reconnect
* @return {Manager} self or value
* @api public
*/
reconnection(v?: any): boolean | this;
/**
* Sets the reconnection attempts config.
*
* @param {Number} max reconnection attempts before giving up
* @return {Manager} self or value
* @api public
*/
reconnectionAttempts(v?: any): number | this;
/**
* Sets the delay between reconnections.
*
* @param {Number} delay
* @return {Manager} self or value
* @api public
*/
reconnectionDelay(v?: any): number | this;
randomizationFactor(v?: any): number | this;
/**
* Sets the maximum delay between reconnections.
*
* @param {Number} delay
* @return {Manager} self or value
* @api public
*/
reconnectionDelayMax(v?: any): number | this;
/**
* Sets the connection timeout. `false` to disable
*
* @return {Manager} self or value
* @api public
*/
timeout(v?: any): any;
/**
* Starts trying to reconnect if reconnection is enabled and we have not
* started reconnecting yet
*
* @api private
*/
maybeReconnectOnOpen(): void;
/**
* Sets the current transport `socket`.
*
* @param {Function} optional, callback
* @return {Manager} self
* @api public
*/
open(fn?: any, opts?: any): this;
connect(fn: any, opts: any): this;
/**
* Called upon transport open.
*
* @api private
*/
onopen(): void;
/**
* Called upon a ping.
*
* @api private
*/
onping(): void;
/**
* Called upon a packet.
*
* @api private
*/
onpong(): void;
/**
* Called with data.
*
* @api private
*/
ondata(data: any): void;
/**
* Called when parser fully decodes a packet.
*
* @api private
*/
ondecoded(packet: any): void;
/**
* Called upon socket error.
*
* @api private
*/
onerror(err: any): void;
/**
* Creates a new socket for the given `nsp`.
*
* @return {Socket}
* @api public
*/
socket(nsp: any, opts: any): any;
/**
* Called upon a socket close.
*
* @param {Socket} socket
*/
destroy(socket: any): void;
/**
* Writes a packet.
*
* @param {Object} packet
* @api private
*/
packet(packet: any): void;
/**
* If packet buffer is non-empty, begins encoding the
* next packet in line.
*
* @api private
*/
processPacketQueue(): void;
/**
* Clean up transport subscriptions and packet buffer.
*
* @api private
*/
cleanup(): void;
/**
* Close the current socket.
*
* @api private
*/
close(): void;
disconnect(): void;
/**
* Called upon engine close.
*
* @api private
*/
onclose(reason: any): void;
/**
* Attempt a reconnection.
*
* @api private
*/
reconnect(): this;
/**
* Called upon successful reconnect.
*
* @api private
*/
onreconnect(): void;
}

0 comments on commit f2f4a4c

Please sign in to comment.