- 
    clearPendingRequests( [error])
- 
    
    
        Clears all pending requests by failing them
     Parameters:
    
    
        
        | Name | Type | Argument | Description |  
            
                | error | Error | <optional> 
 | Error to reject pending requests with |  
 
    
	
	
	
	- Inherited From:
- 
		
	
 Returns:
    - Self for chaining
 
    - 
        Type
    
- 
        
JSONBottleInterface
    
 
- 
    createMessage(path, body)
- 
    
    
        Create new message bound to this interface
     Parameters:
    
    
        
        | Name | Type | Description |  
            
                | path | string | Message path |  
            
                | body | Object | Message body |  
 
    
	
	
	
	- Inherited From:
- 
		
	
 Returns:
    - New message bound to this interface
 
    - 
        Type
    
- 
        
JSONBottleMessage
    
 
- 
    destroyAllSockets()
- 
    
    
        Destroy all sockets
     
    
	
	
	
	- Inherited From:
- 
		
	
 Returns:
    - Self for chaining
 
    - 
        Type
    
- 
        
JSONBottleInterface
    
 
- 
    destroySocket(id)
- 
    
    
        Destroy socket
     Parameters:
    
    
        
        | Name | Type | Description |  
            
                | id | string | Socket id |  
 
    
	
	
	
	- Inherited From:
- 
		
	
 Returns:
    - Socket with the passed id or undefined
 
    - 
        Type
    
- 
        
external:Socket
|
undefined
    
 
- 
    getConfig(key)
- 
    
    
        Get config key
     Parameters:
    
    
        
        | Name | Type | Description |  
            
                | key | string | Key to get the config for |  
 
    
	
	
	
	- Inherited From:
- 
		
	
 Returns:
    - Value for the key or undefined
 
    - 
        Type
    
- 
        
mixed
    
 
- 
    getSocket(id)
- 
    
    
        Get socket by ID
     Parameters:
    
    
        
        | Name | Type | Description |  
            
                | id | string | Socket id |  
 
    
	
	
	
	- Inherited From:
- 
		
	
 Returns:
    - Socket with the passed id or undefined
 
    - 
        Type
    
- 
        
external:Socket
|
undefined
    
 
- 
    getSockets()
- 
    
    
        Get all sockets as array
     
    
	
	
	
	- Inherited From:
- 
		
	
 Returns:
    - All sockets
 
    - 
        Type
    
- 
        
Array.<external:Socket>
    
 
- 
    handleIncomingData(data [, socket])
- 
    
    
        Create message from input data.
Mainly intended for internal use, but can be used from outside
to inject message into the handling cycle.
     Parameters:
    
    
        
        | Name | Type | Argument | Description |  
            
                | data | string
|
JSONBottleMessage~data |  | Either raw JSON string or a message data object (if object, id can be passed as well) |  
            
                | socket | external:Socket | <optional> 
 | If present, represents the socket this message came from, otherwise the message returned will be treated as locally injected |  
 
    
	
	
	
	- Inherited From:
- 
		
	
 Returns:
    - New message object
 
    - 
        Type
    
- 
        
JSONBottleMessage
    
 
- 
    handleIncomingMessage(message)
- 
    
    
        Process message through the next registered handler
     Parameters:
    
	
	
	
	- Inherited From:
- 
		
	
 Returns:
    - Self for chaining
 
    - 
        Type
    
- 
        
JSONBottleInterface
    
 
- 
    request(path, body [, socketId] [, timeout])
- 
    
    
        Issue request
     Parameters:
    
    
        
        | Name | Type | Argument | Description |  
            
                | path | JSONBottleMessage~data.path |  | Send on specified path |  
            
                | body | JSONBottleMessage~data.body |  | Body to send |  
            
                | socketId | string | <optional> 
 | Id of the socket to issue the request to (request will be sent to the first found socket if not provided) |  
            
                | timeout | number | <optional> 
 | Response timeout in milliseconds, 10000 by default |  
 
    
	
	
	
	- Inherited From:
- 
		
	
 Returns:
    - Promise representing the request
 
    - 
        Type
    
- 
        
Promise
    
 
- 
    send(path, body [, socketId])
- 
    
    
        Send body on path to all sockets
     Parameters:
    
    
        
        | Name | Type | Argument | Description |  
            
                | path | JSONBottleMessage~data.path |  | Send on specified path |  
            
                | body | JSONBottleMessage~data.body |  | Body to send |  
            
                | socketId | string
|
Array.<string> | <optional> 
 | If provided, sends to socket id(s) specified, otherwise sends to all socket |  
 
    
	
	
	
	- Inherited From:
- 
		
	
 Returns:
    - Freshly sent message
 
    - 
        Type
    
- 
        
JSONBottleMessage
    
 
- 
    sendMessage(message, sockets [, callback])
- 
    
    
        Send message
     Parameters:
    
	
	
	
	- Inherited From:
- 
		
	
 Returns:
    - Self for chaining
 
    - 
        Type
    
- 
        
JSONBottleInterface
    
 
- 
    sendMessageRequest(message, socket, timeout)
- 
    
    
        Send message as a request (await response)
     Parameters:
    
    
        
        | Name | Type | Description |  
            
                | message | JSONBottleMessage | Message that is issuing a request |  
            
                | socket | external:Socket | Socket to send the request to |  
            
                | timeout | number | Response timeout in milliseconds |  
 
    
	
	
	
	- Inherited From:
- 
		
	
 Returns:
    - Promise representing the request
 
    - 
        Type
    
- 
        
Promise
    
 
- 
    setupSocket(socket)
- 
    
    
        Setup socket
     Parameters:
    
	
	
	
	- Inherited From:
- 
		
	
 Returns:
    - Passed socket
 
    - 
        Type
    
- 
        
external:Socket
    
 
- 
    start(port, host)
- 
    
    
        Start JSONBottleClient instance
     Parameters:
    
    
        
        | Name | Type | Description |  
            
                | port | number | Port to listen to |  
            
                | host | string | Host to bind to |  
 
    
	
	
	
    
    
    
    
	
	
	
	
	
	
	
	
	
 Returns:
    - Self instance for chaining
 
    - 
        Type
    
- 
        
JSONBottleClient
    
 
- 
    stop( [cb])
- 
    
    
        Stop JSONBottleClient instance
     Parameters:
    
    
        
        | Name | Type | Argument | Description |  
            
                | cb | function | <optional> 
 | Callback invoked once the client has stopped |  
 
    
	
	
	
    
    
    
    
	
	
	
	
	
	
	
	
	
 Returns:
    - Self instance for chaining
 
    - 
        Type
    
- 
        
JSONBottleClient
    
 
- 
    use(callback)
- 
    
    
        Use handler for all incoming messages
     Parameters:
    
	
	
	
	- Inherited From:
- 
		
	
 Returns:
    - Self for chaining
 
    - 
        Type
    
- 
        
JSONBottleInterface
    
 
- 
    useOnce(callback)
- 
    
    
        Use handler for any incoming message only once
     Parameters:
    
	
	
	
	- Inherited From:
- 
		
	
 Returns:
    - Self for chaining
 
    - 
        Type
    
- 
        
JSONBottleInterface