Package nl.tue.id.oocsi.client.socket

# Class SocketClient

java.lang.Object
nl.tue.id.oocsi.client.socket.SocketClient

    public class SocketClient
    extends java.lang.Object

OOCSI client interface for socket connections

Author:
  matsfunk

- ## Nested Class Summary

  Nested Classes
  Modifier and Type | Class | Description
  --- | --- | ---
  `static class` | `SocketClient.OOCSIAuthenticationException` |

- ## Field Summary

  Fields
  Modifier and Type | Field | Description
  --- | --- | ---
  `protected SocketClientRunner` | `runner` |

- ## Constructor Summary

  Constructors
  Constructor | Description
  --- | ---
  `SocketClient​(java.lang.String name, java.util.Map<java.lang.String,​Handler> channels, java.util.Map<java.lang.String,​Responder> services)` | create a new socket client with the given name

- ## Method Summary

  Modifier and Type | Method | Description
  --- | --- | ---
  `java.lang.String` | `channels()` | retrieve the current channels on server
  `java.lang.String` | `channels​(java.lang.String channelName)` | retrieve the current sub-channels of the given channel on server
  `java.lang.String` | `clients()` | retrieve the current channels on server
  `boolean` | `connect​(java.lang.String hostname, int port)` | connect to OOCSI at address hostname:port
  `void` | `disconnect()` |
  `java.lang.String` | `getName()` | return client name
  `boolean` | `isConnected()` | check if still connected to OOCSI
  `boolean` | `isReconnect()` |
  `void` | `kill()` |
  `void` | `log​(java.lang.String message)` | logging of message on console (can be overridden by subclass)
  `void` | `reconnect()` |
  `void` | `register​(java.lang.String callName, Responder responder)` | register a responder with a handle "callName"
  `void` | `register​(OOCSICall call)` | register a call in the list of open calls
  `void` | `send​(java.lang.String channelName, java.lang.String message)` | send raw message (no serialization)
  `void` | `send​(java.lang.String channelName, java.util.Map<java.lang.String,​java.lang.Object> data)` | send message with data payload (map of key value pairs which will be serialized before sending)
  `void` | `setReconnect​(boolean reconnect)` | set whether or not a reconnection attempt should be made if a connection fails
  `boolean` | `startMulticastLookup()` | start pinging for a multi-cast lookup
  `void` | `subscribe​(java.lang.String channelName, Handler handler)` | subscribe to channel given by channelName
  `void` | `subscribe​(Handler handler)` | subscribe to channel my own channel
  `void` | `unregister​(java.lang.String callName)` | unregister a responder with a handle "callName"
  `void` | `unsubscribe()` | unsubscribe from my channel
  `void` | `unsubscribe​(java.lang.String channelName)` | unsubscribe from channel given by channelName

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### runner

    protected SocketClientRunner runner

- ## Constructor Details

  - ### SocketClient

    public SocketClient​(java.lang.String name, java.util.Map<java.lang.String,​Handler> channels, java.util.Map<java.lang.String,​Responder> services)
    create a new socket client with the given name
    Parameters:
      `name` -
      `channels` -

- ## Method Details

  - ### startMulticastLookup

    public boolean startMulticastLookup()
    start pinging for a multi-cast lookup
    Returns:

  - ### connect

    public boolean connect​(java.lang.String hostname, int port)
    connect to OOCSI at address hostname:port
    Parameters:
      `hostname` -
      `port` -
    Returns:

  - ### isConnected

    public boolean isConnected()
    check if still connected to OOCSI
    Returns:

  - ### getName

    public java.lang.String getName()
    return client name
    Returns:

  - ### setReconnect

    public void setReconnect​(boolean reconnect)
    set whether or not a reconnection attempt should be made if a connection fails
    Parameters:
      `reconnect` -

  - ### subscribe

    public void subscribe​(java.lang.String channelName, Handler handler)
    subscribe to channel given by channelName
    Parameters:
      `channelName` -
      `handler` -

  - ### subscribe

    public void subscribe​(Handler handler)
    subscribe to channel my own channel
    Parameters:
      `handler` -

  - ### unsubscribe

    public void unsubscribe​(java.lang.String channelName)
    unsubscribe from channel given by channelName
    Parameters:
      `channelName` -

  - ### unsubscribe

    public void unsubscribe()
    unsubscribe from my channel

  - ### register

    public void register​(OOCSICall call)
    register a call in the list of open calls
    Parameters:
      `call` -

  - ### register

    public void register​(java.lang.String callName, Responder responder)
    register a responder with a handle "callName"
    Parameters:
      `callName` -
      `responder` -

  - ### unregister

    public void unregister​(java.lang.String callName)
    unregister a responder with a handle "callName"
    Parameters:
      `callName` -

  - ### send

    public void send​(java.lang.String channelName, java.lang.String message)
    send raw message (no serialization)
    Parameters:
      `channelName` -
      `message` -

  - ### send

    public void send​(java.lang.String channelName, java.util.Map<java.lang.String,​java.lang.Object> data)
    send message with data payload (map of key value pairs which will be serialized before sending)
    Parameters:
      `channelName` -
      `data` -

  - ### clients

    public java.lang.String clients()
    retrieve the current channels on server
    Returns:

  - ### channels

    public java.lang.String channels()
    retrieve the current channels on server
    Returns:

  - ### channels

    public java.lang.String channels​(java.lang.String channelName)
    retrieve the current sub-channels of the given channel on server
    Parameters:
      `channelName` -
    Returns:

  - ### disconnect

    public void disconnect()

  - ### kill

    public void kill()

  - ### reconnect

    public void reconnect()

  - ### isReconnect

    public boolean isReconnect()

  - ### log

    public void log​(java.lang.String message)
    logging of message on console (can be overridden by subclass)