From a3e57318d822575852022dd0acabc15ae77fd2f5 Mon Sep 17 00:00:00 2001 From: efkan Date: Wed, 29 Mar 2017 14:52:07 +0300 Subject: [PATCH] =?UTF-8?q?[docs]=C2=A0Add=20server.engine.generateId=20at?= =?UTF-8?q?tribute=20(#2880)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/API.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/API.md b/docs/API.md index 3d99238719..a59272557b 100644 --- a/docs/API.md +++ b/docs/API.md @@ -6,6 +6,7 @@ - [new Server(port[, options])](#new-serverport-options) - [new Server(options)](#new-serveroptions) - [server.sockets](#serversockets) + - [server.engine.generateId](#serverenginegenerateid) - [server.serveClient([value])](#serverserveclientvalue) - [server.path([value])](#serverpathvalue) - [server.adapter([value])](#serveradaptervalue) @@ -225,6 +226,18 @@ server.listen(PORT); // PORT is free to use io = Server(server); ``` +#### server.engine.generateId + +Overwrites the default method to generate your custom socket id. + +The function is called with a node request object (`http.IncomingMessage`) as first parameter. + +```js +io.engine.generateId = function (req) { + return "custom:id:" + custom_id++; // custom id must be unique +} +``` + ### Namespace Represents a pool of sockets connected under a given scope identified