UNPKG

chat-engine

Version:
1,384 lines (1,383 loc) 293 kB
{ "docs": [ { "comment": "/**\n@class ChatEngine\n@extends RootEmitter\n@return {ChatEngine} Returns an instance of {@link ChatEngine}\n*/", "meta": { "filename": "bootstrap.js", "lineno": 11, "columnno": 0, "path": "/Users/ian/Development/chat-engine/src", "code": {} }, "kind": "class", "name": "ChatEngine", "augments": [ "RootEmitter" ], "returns": [ { "type": { "names": [ "ChatEngine" ] }, "description": "Returns an instance of {@link ChatEngine}" } ], "longname": "ChatEngine", "scope": "global", "___id": "T000002R000010", "___s": true }, { "comment": "/**\n * A map of all known {@link User}s in this instance of ChatEngine.\n * @type {Object}\n * @memberof ChatEngine\n */", "meta": { "range": [ 795, 816 ], "filename": "bootstrap.js", "lineno": 29, "columnno": 4, "path": "/Users/ian/Development/chat-engine/src", "code": { "id": "astnode100000081", "name": "ChatEngine.users", "type": "ObjectExpression", "funcscope": "module.exports", "value": "{}", "paramnames": [] } }, "description": "A map of all known {@link User}s in this instance of ChatEngine.", "type": { "names": [ "Object" ] }, "memberof": "ChatEngine", "name": "users", "longname": "ChatEngine.users", "kind": "member", "scope": "static", "___id": "T000002R000015", "___s": true }, { "comment": "/**\n * A map of all known {@link Chat}s in this instance of ChatEngine.\n * @memberof ChatEngine\n * @type {Object}\n */", "meta": { "range": [ 961, 982 ], "filename": "bootstrap.js", "lineno": 36, "columnno": 4, "path": "/Users/ian/Development/chat-engine/src", "code": { "id": "astnode100000087", "name": "ChatEngine.chats", "type": "ObjectExpression", "funcscope": "module.exports", "value": "{}", "paramnames": [] } }, "description": "A map of all known {@link Chat}s in this instance of ChatEngine.", "memberof": "ChatEngine", "type": { "names": [ "Object" ] }, "name": "chats", "longname": "ChatEngine.chats", "kind": "member", "scope": "static", "___id": "T000002R000016", "___s": true }, { "comment": "/**\n * A global {@link Chat} that all {@link User}s join when they connect to ChatEngine. Useful for announcements, alerts, and global events.\n * @member {Chat} global\n * @memberof ChatEngine\n */", "meta": { "filename": "bootstrap.js", "lineno": 38, "columnno": 4, "path": "/Users/ian/Development/chat-engine/src", "code": {} }, "description": "A global {@link Chat} that all {@link User}s join when they connect to ChatEngine. Useful for announcements, alerts, and global events.", "kind": "member", "name": "global", "type": { "names": [ "Chat" ] }, "memberof": "ChatEngine", "scope": "static", "longname": "ChatEngine.global", "___id": "T000002R000017", "___s": true }, { "comment": "/**\n * This instance of ChatEngine represented as a special {@link User} know as {@link Me}.\n * @member {Me} me\n * @memberof ChatEngine\n */", "meta": { "filename": "bootstrap.js", "lineno": 45, "columnno": 4, "path": "/Users/ian/Development/chat-engine/src", "code": {} }, "description": "This instance of ChatEngine represented as a special {@link User} know as {@link Me}.", "kind": "member", "name": "me", "type": { "names": [ "Me" ] }, "memberof": "ChatEngine", "scope": "static", "longname": "ChatEngine.me", "___id": "T000002R000019", "___s": true }, { "comment": "/**\n * An instance of PubNub, the networking infrastructure that powers the realtime communication between {@link User}s in {@link Chats}.\n * @member {Object} pubnub\n * @memberof ChatEngine\n */", "meta": { "filename": "bootstrap.js", "lineno": 52, "columnno": 4, "path": "/Users/ian/Development/chat-engine/src", "code": {} }, "description": "An instance of PubNub, the networking infrastructure that powers the realtime communication between {@link User}s in {@link Chats}.", "kind": "member", "name": "pubnub", "type": { "names": [ "Object" ] }, "memberof": "ChatEngine", "scope": "static", "longname": "ChatEngine.pubnub", "___id": "T000002R000021", "___s": true }, { "comment": "/**\n * Indicates if ChatEngine has fired the {@link ChatEngine#$\".\"ready} event.\n * @member {Object} ready\n * @memberof ChatEngine\n */", "meta": { "filename": "bootstrap.js", "lineno": 59, "columnno": 4, "path": "/Users/ian/Development/chat-engine/src", "code": {} }, "description": "Indicates if ChatEngine has fired the {@link ChatEngine#$\".\"ready} event.", "kind": "member", "name": "ready", "type": { "names": [ "Object" ] }, "memberof": "ChatEngine", "scope": "static", "longname": "ChatEngine.ready", "___id": "T000002R000023", "___s": true }, { "comment": "/**\n * The package.json for ChatEngine. Used mainly for detecting package version.\n * @type {Object}\n */", "meta": { "range": [ 1978, 2003 ], "filename": "bootstrap.js", "lineno": 70, "columnno": 4, "path": "/Users/ian/Development/chat-engine/src", "code": { "id": "astnode100000117", "name": "ChatEngine.package", "type": "Identifier", "funcscope": "module.exports", "value": "pack", "paramnames": [] } }, "description": "The package.json for ChatEngine. Used mainly for detecting package version.", "type": { "names": [ "Object" ] }, "name": "package", "longname": "module.exports~ChatEngine.package", "kind": "member", "memberof": "module.exports~ChatEngine", "scope": "static", "___id": "T000002R000025", "___s": true }, { "comment": "/**\n * Bind a plugin to all future instances of a Class.\n * @method ChatEngine#proto\n * @param {String} className The string representation of a class to bind to\n * @param {Class} plugin The plugin function.\n */", "meta": { "filename": "bootstrap.js", "lineno": 116, "columnno": 4, "path": "/Users/ian/Development/chat-engine/src", "code": {} }, "description": "Bind a plugin to all future instances of a Class.", "kind": "function", "name": "proto", "params": [ { "type": { "names": [ "String" ] }, "description": "The string representation of a class to bind to", "name": "className" }, { "type": { "names": [ "Class" ] }, "description": "The plugin function.", "name": "plugin" } ], "memberof": "ChatEngine", "longname": "ChatEngine#proto", "scope": "instance", "___id": "T000002R000034", "___s": true }, { "comment": "/**\n * @private\n */", "meta": { "range": [ 3455, 4173 ], "filename": "bootstrap.js", "lineno": 130, "columnno": 4, "path": "/Users/ian/Development/chat-engine/src", "code": { "id": "astnode100000311", "name": "ChatEngine.request", "type": "ArrowFunctionExpression", "funcscope": "module.exports", "paramnames": [ "method", "route", "inputBody", "inputParams" ] }, "vars": { "body": "module.exports~ChatEngine.request~body", "params": "module.exports~ChatEngine.request~params" } }, "access": "private", "name": "request", "longname": "module.exports~ChatEngine.request", "kind": "function", "memberof": "module.exports~ChatEngine", "scope": "static", "___id": "T000002R000037", "___s": true }, { "comment": "/**\n * Parse a channel name into chat object parts\n * @private\n */", "meta": { "range": [ 4263, 4479 ], "filename": "bootstrap.js", "lineno": 160, "columnno": 4, "path": "/Users/ian/Development/chat-engine/src", "code": { "id": "astnode100000418", "name": "ChatEngine.parseChannel", "type": "ArrowFunctionExpression", "funcscope": "module.exports", "paramnames": [ "channel" ] }, "vars": { "info": "module.exports~ChatEngine.parseChannel~info" } }, "description": "Parse a channel name into chat object parts", "access": "private", "name": "parseChannel", "longname": "module.exports~ChatEngine.parseChannel", "kind": "function", "memberof": "module.exports~ChatEngine", "scope": "static", "___id": "T000002R000050", "___s": true }, { "comment": "/**\n * Get the internal channel name of supplied string\n * @private\n */", "meta": { "range": [ 4574, 5200 ], "filename": "bootstrap.js", "lineno": 176, "columnno": 4, "path": "/Users/ian/Development/chat-engine/src", "code": { "id": "astnode100000450", "name": "ChatEngine.augmentChannel", "type": "ArrowFunctionExpression", "funcscope": "module.exports", "paramnames": [ "original", "isPrivate" ] }, "vars": { "channel": "module.exports~ChatEngine.augmentChannel~channel", "chanPrivString": "module.exports~ChatEngine.augmentChannel~chanPrivString" } }, "description": "Get the internal channel name of supplied string", "access": "private", "name": "augmentChannel", "longname": "module.exports~ChatEngine.augmentChannel", "kind": "function", "memberof": "module.exports~ChatEngine", "scope": "static", "___id": "T000002R000055", "___s": true }, { "comment": "/**\n * Initial communication with the server. Server grants permissions to\n * talk in chats, etc.\n * @private\n */", "meta": { "range": [ 5341, 6433 ], "filename": "bootstrap.js", "lineno": 201, "columnno": 4, "path": "/Users/ian/Development/chat-engine/src", "code": { "id": "astnode100000517", "name": "ChatEngine.handshake", "type": "ArrowFunctionExpression", "funcscope": "module.exports", "paramnames": [ "complete" ] }, "vars": { "": null } }, "description": "Initial communication with the server. Server grants permissions to\ntalk in chats, etc.", "access": "private", "name": "handshake", "longname": "module.exports~ChatEngine.handshake", "kind": "function", "memberof": "module.exports~ChatEngine", "scope": "static", "___id": "T000002R000060", "___s": true }, { "comment": "/**\n * Listen to PubNub events and forward them into ChatEngine system.\n * @private\n */", "meta": { "range": [ 6544, 9732 ], "filename": "bootstrap.js", "lineno": 240, "columnno": 4, "path": "/Users/ian/Development/chat-engine/src", "code": { "id": "astnode100000662", "name": "ChatEngine.listenToPubNub", "type": "ArrowFunctionExpression", "funcscope": "module.exports", "paramnames": [] }, "vars": { "": null } }, "description": "Listen to PubNub events and forward them into ChatEngine system.", "access": "private", "name": "listenToPubNub", "longname": "module.exports~ChatEngine.listenToPubNub", "kind": "function", "memberof": "module.exports~ChatEngine", "scope": "static", "___id": "T000002R000062", "___s": true }, { "comment": "/**\n * SDK detected that network is online.\n * @event ChatEngine#$\".\"network\".\"up\".\"online\n */", "meta": { "filename": "bootstrap.js", "lineno": 262, "columnno": 16, "path": "/Users/ian/Development/chat-engine/src", "code": {} }, "description": "SDK detected that network is online.", "kind": "event", "name": "$\".\"network\".\"up\".\"online", "memberof": "ChatEngine", "longname": "ChatEngine#event:$\".\"network\".\"up\".\"online", "scope": "instance", "___id": "T000002R000067", "___s": true }, { "comment": "/**\n * SDK detected that network is down.\n * @event ChatEngine#$\".\"network\".\"down\".\"offline\n */", "meta": { "filename": "bootstrap.js", "lineno": 267, "columnno": 16, "path": "/Users/ian/Development/chat-engine/src", "code": {} }, "description": "SDK detected that network is down.", "kind": "event", "name": "$\".\"network\".\"down\".\"offline", "memberof": "ChatEngine", "longname": "ChatEngine#event:$\".\"network\".\"down\".\"offline", "scope": "instance", "___id": "T000002R000068", "___s": true }, { "comment": "/**\n * A subscribe event experienced an exception when running.\n * @event ChatEngine#$\".\"network\".\"down\".\"issue\n */", "meta": { "filename": "bootstrap.js", "lineno": 272, "columnno": 16, "path": "/Users/ian/Development/chat-engine/src", "code": {} }, "description": "A subscribe event experienced an exception when running.", "kind": "event", "name": "$\".\"network\".\"down\".\"issue", "memberof": "ChatEngine", "longname": "ChatEngine#event:$\".\"network\".\"down\".\"issue", "scope": "instance", "___id": "T000002R000069", "___s": true }, { "comment": "/**\n * SDK was able to reconnect to pubnub.\n * @event ChatEngine#$\".\"network\".\"up\".\"reconnected\n */", "meta": { "filename": "bootstrap.js", "lineno": 277, "columnno": 16, "path": "/Users/ian/Development/chat-engine/src", "code": {} }, "description": "SDK was able to reconnect to pubnub.", "kind": "event", "name": "$\".\"network\".\"up\".\"reconnected", "memberof": "ChatEngine", "longname": "ChatEngine#event:$\".\"network\".\"up\".\"reconnected", "scope": "instance", "___id": "T000002R000070", "___s": true }, { "comment": "/**\n * SDK subscribed with a new mix of channels.\n * @event ChatEngine#$\".\"network\".\"up\".\"connected\n */", "meta": { "filename": "bootstrap.js", "lineno": 282, "columnno": 16, "path": "/Users/ian/Development/chat-engine/src", "code": {} }, "description": "SDK subscribed with a new mix of channels.", "kind": "event", "name": "$\".\"network\".\"up\".\"connected", "memberof": "ChatEngine", "longname": "ChatEngine#event:$\".\"network\".\"up\".\"connected", "scope": "instance", "___id": "T000002R000071", "___s": true }, { "comment": "/**\n * JSON parsing crashed.\n * @event ChatEngine#$\".\"network\".\"down\".\"malformed\n */", "meta": { "filename": "bootstrap.js", "lineno": 287, "columnno": 16, "path": "/Users/ian/Development/chat-engine/src", "code": {} }, "description": "JSON parsing crashed.", "kind": "event", "name": "$\".\"network\".\"down\".\"malformed", "memberof": "ChatEngine", "longname": "ChatEngine#event:$\".\"network\".\"down\".\"malformed", "scope": "instance", "___id": "T000002R000072", "___s": true }, { "comment": "/**\n * Server rejected the request.\n * @event ChatEngine#$\".\"network\".\"down\".\"badrequest\n */", "meta": { "filename": "bootstrap.js", "lineno": 292, "columnno": 16, "path": "/Users/ian/Development/chat-engine/src", "code": {} }, "description": "Server rejected the request.", "kind": "event", "name": "$\".\"network\".\"down\".\"badrequest", "memberof": "ChatEngine", "longname": "ChatEngine#event:$\".\"network\".\"down\".\"badrequest", "scope": "instance", "___id": "T000002R000073", "___s": true }, { "comment": "/**\n * If using decryption strategies and the decryption fails.\n * @event ChatEngine#$\".\"network\".\"down\".\"decryption\n */", "meta": { "filename": "bootstrap.js", "lineno": 297, "columnno": 16, "path": "/Users/ian/Development/chat-engine/src", "code": {} }, "description": "If using decryption strategies and the decryption fails.", "kind": "event", "name": "$\".\"network\".\"down\".\"decryption", "memberof": "ChatEngine", "longname": "ChatEngine#event:$\".\"network\".\"down\".\"decryption", "scope": "instance", "___id": "T000002R000074", "___s": true }, { "comment": "/**\n * Request timed out.\n * @event ChatEngine#$\".\"network\".\"down\".\"timeout\n */", "meta": { "filename": "bootstrap.js", "lineno": 302, "columnno": 16, "path": "/Users/ian/Development/chat-engine/src", "code": {} }, "description": "Request timed out.", "kind": "event", "name": "$\".\"network\".\"down\".\"timeout", "memberof": "ChatEngine", "longname": "ChatEngine#event:$\".\"network\".\"down\".\"timeout", "scope": "instance", "___id": "T000002R000075", "___s": true }, { "comment": "/**\n * PAM permission failure.\n * @event ChatEngine#$\".\"network\".\"down\".\"denied\n */", "meta": { "filename": "bootstrap.js", "lineno": 307, "columnno": 16, "path": "/Users/ian/Development/chat-engine/src", "code": {} }, "description": "PAM permission failure.", "kind": "event", "name": "$\".\"network\".\"down\".\"denied", "memberof": "ChatEngine", "longname": "ChatEngine#event:$\".\"network\".\"down\".\"denied", "scope": "instance", "___id": "T000002R000076", "___s": true }, { "comment": "/**\n * Subscribe to PubNub and begin receiving events.\n * @private\n */", "meta": { "range": [ 9826, 10254 ], "filename": "bootstrap.js", "lineno": 339, "columnno": 4, "path": "/Users/ian/Development/chat-engine/src", "code": { "id": "astnode100000796", "name": "ChatEngine.subscribeToPubNub", "type": "ArrowFunctionExpression", "funcscope": "module.exports", "paramnames": [] }, "vars": { "chanGroups": "module.exports~ChatEngine.subscribeToPubNub~chanGroups" } }, "description": "Subscribe to PubNub and begin receiving events.", "access": "private", "name": "subscribeToPubNub", "longname": "module.exports~ChatEngine.subscribeToPubNub", "kind": "function", "memberof": "module.exports~ChatEngine", "scope": "static", "___id": "T000002R000089", "___s": true }, { "comment": "/**\n * Initialize ChatEngine modules on first time boot.\n * @private\n */", "meta": { "range": [ 10350, 12167 ], "filename": "bootstrap.js", "lineno": 358, "columnno": 4, "path": "/Users/ian/Development/chat-engine/src", "code": { "id": "astnode100000858", "name": "ChatEngine.firstConnect", "type": "ArrowFunctionExpression", "funcscope": "module.exports", "paramnames": [ "state" ] }, "vars": { "ChatEngine.pubnub": "module.exports~ChatEngine.pubnub", "ChatEngine.global": "module.exports~ChatEngine.global", "": null } }, "description": "Initialize ChatEngine modules on first time boot.", "access": "private", "name": "firstConnect", "longname": "module.exports~ChatEngine.firstConnect", "kind": "function", "memberof": "module.exports~ChatEngine", "scope": "static", "___id": "T000002R000093", "___s": true }, { "comment": "/**\n * Fired when a {@link Me} has been created within ChatEngine.\n * @event ChatEngine#$\".\"created\".\"me\n * @example\n * ChatEngine.on('$.created.me', (data, me) => {\n * console.log('Me was created', me);\n * });\n */", "meta": { "filename": "bootstrap.js", "lineno": 371, "columnno": 12, "path": "/Users/ian/Development/chat-engine/src", "code": {} }, "description": "Fired when a {@link Me} has been created within ChatEngine.", "kind": "event", "name": "$\".\"created\".\"me", "examples": [ "ChatEngine.on('$.created.me', (data, me) => {\n console.log('Me was created', me);\n});" ], "memberof": "ChatEngine", "longname": "ChatEngine#event:$\".\"created\".\"me", "scope": "instance", "___id": "T000002R000097", "___s": true }, { "comment": "/**\n * Fired when ChatEngine is connected to the internet and ready to go!\n * @event ChatEngine#$\".\"ready\n * @example\n * ChatEngine.on('$.ready', (data) => {\n * let me = data.me;\n * })\n */", "meta": { "filename": "bootstrap.js", "lineno": 387, "columnno": 16, "path": "/Users/ian/Development/chat-engine/src", "code": {} }, "description": "Fired when ChatEngine is connected to the internet and ready to go!", "kind": "event", "name": "$\".\"ready", "examples": [ "ChatEngine.on('$.ready', (data) => {\n let me = data.me;\n})" ], "memberof": "ChatEngine", "longname": "ChatEngine#event:$\".\"ready", "scope": "instance", "___id": "T000002R000098", "___s": true }, { "comment": "/**\n * Disconnect from all {@link Chat}s and mark them as asleep.\n * @method ChatEngine#disconnect\n * @example\n *\n * // create a new chat\n * let chat = new ChatEngine.Chat(new Date().getTime());\n *\n * // disconnect from ChatEngine\n * ChatEngine.disconnect();\n *\n * // every individual chat will be disconnected\n * chat.on('$.disconnected', () => {\n * done();\n * });\n *\n * // Changing User:\n * ChatEngine.disconnect()\n * ChatEngine = new ChatEngine({}, {});\n * ChatEngine.connect()\n */", "meta": { "filename": "bootstrap.js", "lineno": 416, "columnno": 4, "path": "/Users/ian/Development/chat-engine/src", "code": {} }, "description": "Disconnect from all {@link Chat}s and mark them as asleep.", "kind": "function", "name": "disconnect", "examples": [ "// create a new chat\nlet chat = new ChatEngine.Chat(new Date().getTime());\n\n// disconnect from ChatEngine\nChatEngine.disconnect();\n\n// every individual chat will be disconnected\nchat.on('$.disconnected', () => {\n done();\n});\n\n// Changing User:\nChatEngine.disconnect()\nChatEngine = new ChatEngine({}, {});\nChatEngine.connect()" ], "memberof": "ChatEngine", "longname": "ChatEngine#disconnect", "scope": "instance", "___id": "T000002R000101", "___s": true }, { "comment": "/**\n * Performs authentication with server and restores connection\n * to all sleeping chats.\n * @method ChatEngine#reconnect\n * @example\n *\n * // create a new chat\n * let chat = new ChatEngine.Chat(new Date().getTime());\n *\n * // disconnect from ChatEngine\n * ChatEngine.disconnect();\n *\n * // reconnect sometime later\n * ChatEngine.reconnect();\n *\n */", "meta": { "filename": "bootstrap.js", "lineno": 449, "columnno": 4, "path": "/Users/ian/Development/chat-engine/src", "code": {} }, "description": "Performs authentication with server and restores connection\nto all sleeping chats.", "kind": "function", "name": "reconnect", "examples": [ "// create a new chat\nlet chat = new ChatEngine.Chat(new Date().getTime());\n\n// disconnect from ChatEngine\nChatEngine.disconnect();\n\n// reconnect sometime later\nChatEngine.reconnect();" ], "memberof": "ChatEngine", "longname": "ChatEngine#reconnect", "scope": "instance", "___id": "T000002R000103", "___s": true }, { "comment": "/**\n @private\n */", "meta": { "range": [ 14147, 14284 ], "filename": "bootstrap.js", "lineno": 489, "columnno": 4, "path": "/Users/ian/Development/chat-engine/src", "code": { "id": "astnode100001110", "name": "ChatEngine.setAuth", "type": "ArrowFunctionExpression", "funcscope": "module.exports", "paramnames": [ "authKey" ] }, "vars": { "ChatEngine.pnConfig.authKey": "module.exports~ChatEngine.pnConfig.authKey" } }, "access": "private", "name": "setAuth", "longname": "module.exports~ChatEngine.setAuth", "kind": "function", "memberof": "module.exports~ChatEngine", "scope": "static", "___id": "T000002R000105", "___s": true }, { "comment": "/**\n * Disconnects, changes authentication token, performs handshake with server\n * and reconnects with new auth key. Used for extending logged in sessions\n * for active users.\n * @method ChatEngine#reauthorize\n * @example\n * // early\n * ChatEngine.connect(...);\n *\n * ChatEngine.once('$.connected', () => {\n * // first connection established\n * });\n *\n * // some time passes, session token expires\n * ChatEngine.reauthorize(authKey);\n *\n * // we are connected again\n * ChatEngine.once('$.connected', () => {\n * // we are connected again\n * });\n */", "meta": { "filename": "bootstrap.js", "lineno": 496, "columnno": 4, "path": "/Users/ian/Development/chat-engine/src", "code": {} }, "description": "Disconnects, changes authentication token, performs handshake with server\nand reconnects with new auth key. Used for extending logged in sessions\nfor active users.", "kind": "function", "name": "reauthorize", "examples": [ "// early\nChatEngine.connect(...);\n\nChatEngine.once('$.connected', () => {\n // first connection established\n});\n\n// some time passes, session token expires\nChatEngine.reauthorize(authKey);\n\n// we are connected again\nChatEngine.once('$.connected', () => {\n // we are connected again\n});" ], "memberof": "ChatEngine", "longname": "ChatEngine#reauthorize", "scope": "instance", "___id": "T000002R000107", "___s": true }, { "comment": "/**\n * Connect to realtime service and create instance of {@link Me}\n * @method ChatEngine#connect\n * @param {String} uuid A unique string for {@link Me}. It can be a device id, username, user id, email, etc. Must be alphanumeric.\n * @param {Object} state An object containing information about this client ({@link Me}). This JSON object is sent to all other clients on the network, so no passwords!\n * @param {String} [authKey] A authentication secret. Will be sent to authentication backend for validation. This is usually an access token. See {@tutorial auth} for more.\n * @fires $\".\"connected\n */", "meta": { "filename": "bootstrap.js", "lineno": 530, "columnno": 4, "path": "/Users/ian/Development/chat-engine/src", "code": {} }, "description": "Connect to realtime service and create instance of {@link Me}", "kind": "function", "name": "connect", "params": [ { "type": { "names": [ "String" ] }, "description": "A unique string for {@link Me}. It can be a device id, username, user id, email, etc. Must be alphanumeric.", "name": "uuid" }, { "type": { "names": [ "Object" ] }, "description": "An object containing information about this client ({@link Me}). This JSON object is sent to all other clients on the network, so no passwords!", "name": "state" }, { "type": { "names": [ "String" ] }, "optional": true, "description": "A authentication secret. Will be sent to authentication backend for validation. This is usually an access token. See {@tutorial auth} for more.", "name": "authKey" } ], "fires": [ "event:$\".\"connected" ], "memberof": "ChatEngine", "longname": "ChatEngine#connect", "scope": "instance", "___id": "T000002R000109", "___s": true }, { "comment": "/**\n * The {@link Chat} class. Creates a new Chat when initialized, or returns an existing instance if chat has already been created.\n * @member {Chat} Chat\n * @memberof ChatEngine\n * @see {@link Chat}\n */", "meta": { "filename": "bootstrap.js", "lineno": 568, "columnno": 4, "path": "/Users/ian/Development/chat-engine/src", "code": {} }, "description": "The {@link Chat} class. Creates a new Chat when initialized, or returns an existing instance if chat has already been created.", "kind": "member", "name": "Chat", "type": { "names": [ "Chat" ] }, "memberof": "ChatEngine", "see": [ "{@link Chat}" ], "scope": "static", "longname": "ChatEngine.Chat", "___id": "T000002R000114", "___s": true }, { "comment": "/**\n * Fired when a {@link Chat} has been created within ChatEngine.\n * @event ChatEngine#$\".\"created\".\"chat\n * @example\n * ChatEngine.on('$.created.chat', (data, chat) => {\n * console.log('Chat was created', chat);\n * });\n */", "meta": { "filename": "bootstrap.js", "lineno": 584, "columnno": 12, "path": "/Users/ian/Development/chat-engine/src", "code": {} }, "description": "Fired when a {@link Chat} has been created within ChatEngine.", "kind": "event", "name": "$\".\"created\".\"chat", "examples": [ "ChatEngine.on('$.created.chat', (data, chat) => {\n console.log('Chat was created', chat);\n});" ], "memberof": "ChatEngine", "longname": "ChatEngine#event:$\".\"created\".\"chat", "scope": "instance", "___id": "T000002R000118", "___s": true }, { "comment": "/**\n * The {@link User} class. Creates a new User when initialized, or returns an existing instance if chat has already been created.\n * @member {User} User\n * @memberof ChatEngine\n * @see {@link User}\n */", "meta": { "filename": "bootstrap.js", "lineno": 600, "columnno": 4, "path": "/Users/ian/Development/chat-engine/src", "code": {} }, "description": "The {@link User} class. Creates a new User when initialized, or returns an existing instance if chat has already been created.", "kind": "member", "name": "User", "type": { "names": [ "User" ] }, "memberof": "ChatEngine", "see": [ "{@link User}" ], "scope": "static", "longname": "ChatEngine.User", "___id": "T000002R000119", "___s": true }, { "comment": "/**\n * Fired when a {@link User} has been created within ChatEngine.\n * @event ChatEngine#$\".\"created\".\"user\n * @example\n * ChatEngine.on('$.created.user', (data, user) => {\n * console.log('Chat was created', user);\n * });\n */", "meta": { "filename": "bootstrap.js", "lineno": 616, "columnno": 12, "path": "/Users/ian/Development/chat-engine/src", "code": {} }, "description": "Fired when a {@link User} has been created within ChatEngine.", "kind": "event", "name": "$\".\"created\".\"user", "examples": [ "ChatEngine.on('$.created.user', (data, user) => {\n console.log('Chat was created', user);\n});" ], "memberof": "ChatEngine", "longname": "ChatEngine#event:$\".\"created\".\"user", "scope": "instance", "___id": "T000002R000122", "___s": true }, { "comment": "/**\n This is the root {@link Chat} class that represents a chat room\n\n @param {String} [channel=new Date().getTime()] A unique identifier for this chat {@link Chat}. Must be alphanumeric. The channel is the unique name of a {@link Chat}, and is usually something like \"The Watercooler\", \"Support\", or \"Off Topic\". See [PubNub Channels](https://support.pubnub.com/support/solutions/articles/14000045182-what-is-a-channel-).\n @param {Boolean} [isPrivate=true] Attempt to authenticate ourselves before connecting to this {@link Chat}.\n @param {Boolean} [autoConnect=true] Connect to this chat as soon as its initiated. If set to ```false```, call the {@link Chat#connect} method to connect to this {@link Chat}.\n @param {Object} [meta={}] Chat metadata that will be persisted on the server and populated on creation.\n @param {String} [group='default'] Groups chat into a \"type\". This is the key which chats will be grouped into within {@link Me.session} object.\n @class Chat\n @extends Emitter\n @extends RootEmitter\n @fires Chat#$\".\"ready\n @fires Chat#$\".\"state\n @fires Chat#$\".\"online\".\"*\n @fires Chat#$\".\"offline\".\"*\n */", "meta": { "filename": "chat.js", "lineno": 9, "columnno": 0, "path": "/Users/ian/Development/chat-engine/src/components", "code": {} }, "description": "This is the root {@link Chat} class that represents a chat room", "params": [ { "type": { "names": [ "String" ] }, "optional": true, "defaultvalue": "new Date().getTime()", "description": "A unique identifier for this chat {@link Chat}. Must be alphanumeric. The channel is the unique name of a {@link Chat}, and is usually something like \"The Watercooler\", \"Support\", or \"Off Topic\". See [PubNub Channels](https://support.pubnub.com/support/solutions/articles/14000045182-what-is-a-channel-).", "name": "channel" }, { "type": { "names": [ "Boolean" ] }, "optional": true, "defaultvalue": true, "description": "Attempt to authenticate ourselves before connecting to this {@link Chat}.", "name": "isPrivate" }, { "type": { "names": [ "Boolean" ] }, "optional": true, "defaultvalue": true, "description": "Connect to this chat as soon as its initiated. If set to ```false```, call the {@link Chat#connect} method to connect to this {@link Chat}.", "name": "autoConnect" }, { "type": { "names": [ "Object" ] }, "optional": true, "defaultvalue": "{}", "description": "Chat metadata that will be persisted on the server and populated on creation.", "name": "meta" }, { "type": { "names": [ "String" ] }, "optional": true, "defaultvalue": "'default'", "description": "Groups chat into a \"type\". This is the key which chats will be grouped into within {@link Me.session} object.", "name": "group" } ], "kind": "class", "name": "Chat", "augments": [ "Emitter", "RootEmitter" ], "fires": [ "Chat#event:$\".\"ready", "Chat#event:$\".\"state", "Chat#event:$\".\"online\".\"*", "Chat#event:$\".\"offline\".\"*" ], "longname": "Chat", "scope": "global", "___id": "T000002R000128", "___s": true }, { "comment": "/**\n * Classify the chat within some group, Valid options are 'system', 'fixed', or 'custom'.\n * @type Boolean\n * @readonly\n * @private\n */", "meta": { "range": [ 1854, 1872 ], "filename": "chat.js", "lineno": 43, "columnno": 8, "path": "/Users/ian/Development/chat-engine/src/components", "code": { "id": "astnode100001479", "name": "this.group", "type": "Identifier", "value": "group", "paramnames": [] } }, "description": "Classify the chat within some group, Valid options are 'system', 'fixed', or 'custom'.", "type": { "names": [ "Boolean" ] }, "readonly": true, "access": "private", "name": "group", "longname": "Chat#group", "kind": "member", "memberof": "Chat", "scope": "instance", "___id": "T000002R000133", "___s": true }, { "comment": "/**\n * Excludes all users from reading or writing to the {@link chat} unless they have been explicitly invited via {@link Chat#invite};\n * @type Boolean\n * @readonly\n */", "meta": { "range": [ 2089, 2115 ], "filename": "chat.js", "lineno": 50, "columnno": 8, "path": "/Users/ian/Development/chat-engine/src/components", "code": { "id": "astnode100001485", "name": "this.isPrivate", "type": "Identifier", "value": "isPrivate", "paramnames": [] } }, "description": "Excludes all users from reading or writing to the {@link chat} unless they have been explicitly invited via {@link Chat#invite};", "type": { "names": [ "Boolean" ] }, "readonly": true, "name": "isPrivate", "longname": "Chat#isPrivate", "kind": "member", "memberof": "Chat", "scope": "instance", "___id": "T000002R000134", "___s": true }, { "comment": "/**\n * Chat metadata persisted on the server. Useful for storing things like the name and description. Call {@link Chat#update} to update the remote information.\n * @type Object\n * @readonly\n */", "meta": { "range": [ 2361, 2383 ], "filename": "chat.js", "lineno": 57, "columnno": 8, "path": "/Users/ian/Development/chat-engine/src/components", "code": { "id": "astnode100001491", "name": "this.meta", "type": "LogicalExpression", "value": "", "paramnames": [] } }, "description": "Chat metadata persisted on the server. Useful for storing things like the name and description. Call {@link Chat#update} to update the remote information.", "type": { "names": [ "Object" ] }, "readonly": true, "name": "meta", "longname": "Chat#meta", "kind": "member", "memberof": "Chat", "scope": "instance", "___id": "T000002R000135", "___s": true }, { "comment": "/**\n * A string identifier for the Chat room. Any chat with an identical channel will be able to communicate with one another.\n * @type String\n * @readonly\n * @see [PubNub Channels](https://support.pubnub.com/support/solutions/articles/14000045182-what-is-a-channel-)\n */", "meta": { "range": [ 2714, 2784 ], "filename": "chat.js", "lineno": 65, "columnno": 8, "path": "/Users/ian/Development/chat-engine/src/components", "code": { "id": "astnode100001499", "name": "this.channel", "type": "CallExpression", "value": "", "paramnames": [] } }, "description": "A string identifier for the Chat room. Any chat with an identical channel will be able to communicate with one another.", "type": { "names": [ "String" ] }, "readonly": true, "see": [ "[PubNub Channels](https://support.pubnub.com/support/solutions/articles/14000045182-what-is-a-channel-)" ], "name": "channel", "longname": "Chat#channel", "kind": "member", "memberof": "Chat", "scope": "instance", "___id": "T000002R000136", "___s": true }, { "comment": "/**\n A list of users in this {@link Chat}. Automatically kept in sync as users join and leave the chat.\n Use [$.join](/Chat.html#event:$%2522.%2522join) and related events to get notified when this changes\n\n @type Object\n @readonly\n */", "meta": { "range": [ 3079, 3094 ], "filename": "chat.js", "lineno": 74, "columnno": 8, "path": "/Users/ian/Development/chat-engine/src/components", "code": { "id": "astnode100001514", "name": "this.users", "type": "ObjectExpression", "value": "{}", "paramnames": [] } }, "description": "A list of users in this {@link Chat}. Automatically kept in sync as users join and leave the chat.\n Use [$.join](/Chat.html#event:$%2522.%2522join) and related events to get notified when this changes", "type": { "names": [ "Object" ] }, "readonly": true, "name": "users", "longname": "Chat#users", "kind": "member", "memberof": "Chat", "scope": "instance", "___id": "T000002R000137", "___s": true }, { "comment": "/**\n * Boolean value that indicates of the Chat is connected to the network\n * @type {Boolean}\n */", "meta": { "range": [ 3236, 3258 ], "filename": "chat.js", "lineno": 80, "columnno": 8, "path": "/Users/ian/Development/chat-engine/src/components", "code": { "id": "astnode100001520", "name": "this.connected", "type": "Literal", "value": false, "paramnames": [] } }, "description": "Boolean value that indicates of the Chat is connected to the network", "type": { "names": [ "Boolean" ] }, "name": "connected", "longname": "Chat#connected", "kind": "member", "memberof": "Chat", "scope": "instance", "___id": "T000002R000138", "___s": true }, { "comment": "/**\n * Keep a record if we've every successfully connected to this chat before.\n * @type {Boolean}\n */", "meta": { "range": [ 3404, 3429 ], "filename": "chat.js", "lineno": 86, "columnno": 8, "path": "/Users/ian/Development/chat-engine/src/components", "code": { "id": "astnode100001526", "name": "this.hasConnected", "type": "Literal", "value": false, "paramnames": [] } }, "description": "Keep a record if we've every successfully connected to this chat before.", "type": { "names": [ "Boolean" ] }, "name": "hasConnected", "longname": "Chat#hasConnected", "kind": "member", "memberof": "Chat", "scope": "instance", "___id": "T000002R000139", "___s": true }, { "comment": "/**\n * If user manually disconnects via {@link ChatEngine#disconnect}, the\n * chat is put to \"sleep\". If a connection is reestablished\n * via {@link ChatEngine#reconnect}, sleeping chats reconnect automatically.\n * @type {Boolean}\n */", "meta": { "range": [ 3723, 3742 ], "filename": "chat.js", "lineno": 94, "columnno": 8, "path": "/Users/ian/Development/chat-engine/src/components", "code": { "id": "astnode100001532", "name": "this.asleep", "type": "Literal", "value": false, "paramnames": [] } }, "description": "If user manually disconnects via {@link ChatEngine#disconnect}, the\nchat is put to \"sleep\". If a connection is reestablished\nvia {@link ChatEngine#reconnect}, sleeping chats reconnect automatically.", "type": { "names": [ "Boolean" ] }, "name": "asleep", "longname": "Chat#asleep", "kind": "member", "memberof": "Chat", "scope": "instance", "___id": "T000002R000140", "___s": true }, { "comment": "/**\n Updates list of {@link User}s in this {@link Chat}\n based on who is online now.\n\n @private\n @param {Object} status The response status\n @param {Object} response The response payload object\n */", "meta": { "range": [ 4123, 4844 ], "filename": "chat.js", "lineno": 114, "columnno": 4, "path": "/Users/ian/Development/chat-engine/src/components", "code": { "id": "astnode100001559", "name": "Chat#onHereNow", "type": "MethodDefinition", "paramnames": [ "status", "response" ] }, "vars": { "": null } }, "description": "Updates list of {@link User}s in this {@link Chat}\n based on who is online now.", "access": "private", "params": [ { "type": { "names": [ "Object" ] }, "description": "The response status", "name": "status" }, { "type": { "names": [ "Object" ] }, "description": "The response payload object", "name": "response" } ], "name": "onHereNow", "longname": "Chat#onHereNow", "kind": "function", "memberof": "Chat", "scope": "instance", "___id": "T000002R000142", "___s": true }, { "comment": "/**\n * There was a problem fetching the presence of this chat\n * @event Chat#$\".\"error\".\"presence\n */", "meta": { "filename": "chat.js", "lineno": 118,