HubConnection Class
- java.
lang. Object - com.
microsoft. signalr. HubConnection
- com.
Implements
public class HubConnection implements AutoCloseable
A connection used to invoke hub methods on a SignalR Server.
Method Summary
Modifier and Type | Method and Description |
---|---|
Subscription |
<T1,T2,T3,T4,T5,T6,T7,T8>on(String target, Action8<T1,T2,T3,T4,T5,T6,T7,T8> callback, Class<T1> param1, Class<T2> param2, Class<T3> param3, Class<T4> param4, Class<T5> param5, Class<T6> param6, Class<T7> param7, Class<T8> param8)
Registers a handler that will be invoked when the hub method with the specified method name is invoked. |
Subscription |
<T1,T2,T3,T4,T5,T6,T7,T8>on(String target, Action8<T1,T2,T3,T4,T5,T6,T7,T8> callback, Type param1, Type param2, Type param3, Type param4, Type param5, Type param6, Type param7, Type param8)
Registers a handler that will be invoked when the hub method with the specified method name is invoked. |
Subscription |
<T1,T2,T3,T4,T5,T6,T7>on(String target, Action7<T1,T2,T3,T4,T5,T6,T7> callback, Class<T1> param1, Class<T2> param2, Class<T3> param3, Class<T4> param4, Class<T5> param5, Class<T6> param6, Class<T7> param7)
Registers a handler that will be invoked when the hub method with the specified method name is invoked. |
Subscription |
<T1,T2,T3,T4,T5,T6,T7>on(String target, Action7<T1,T2,T3,T4,T5,T6,T7> callback, Type param1, Type param2, Type param3, Type param4, Type param5, Type param6, Type param7)
Registers a handler that will be invoked when the hub method with the specified method name is invoked. |
Subscription |
<T1,T2,T3,T4,T5,T6>on(String target, Action6<T1,T2,T3,T4,T5,T6> callback, Class<T1> param1, Class<T2> param2, Class<T3> param3, Class<T4> param4, Class<T5> param5, Class<T6> param6)
Registers a handler that will be invoked when the hub method with the specified method name is invoked. |
Subscription |
<T1,T2,T3,T4,T5,T6>on(String target, Action6<T1,T2,T3,T4,T5,T6> callback, Type param1, Type param2, Type param3, Type param4, Type param5, Type param6)
Registers a handler that will be invoked when the hub method with the specified method name is invoked. |
Subscription |
<T1,T2,T3,T4,T5>on(String target, Action5<T1,T2,T3,T4,T5> callback, Class<T1> param1, Class<T2> param2, Class<T3> param3, Class<T4> param4, Class<T5> param5)
Registers a handler that will be invoked when the hub method with the specified method name is invoked. |
Subscription |
<T1,T2,T3,T4,T5>on(String target, Action5<T1,T2,T3,T4,T5> callback, Type param1, Type param2, Type param3, Type param4, Type param5)
Registers a handler that will be invoked when the hub method with the specified method name is invoked. |
Subscription |
<T1,T2,T3,T4>on(String target, Action4<T1,T2,T3,T4> callback, Class<T1> param1, Class<T2> param2, Class<T3> param3, Class<T4> param4)
Registers a handler that will be invoked when the hub method with the specified method name is invoked. |
Subscription |
<T1,T2,T3,T4>on(String target, Action4<T1,T2,T3,T4> callback, Type param1, Type param2, Type param3, Type param4)
Registers a handler that will be invoked when the hub method with the specified method name is invoked. |
Subscription |
<T1,T2,T3>on(String target, Action3<T1,T2,T3> callback, Class<T1> param1, Class<T2> param2, Class<T3> param3)
Registers a handler that will be invoked when the hub method with the specified method name is invoked. |
Subscription |
<T1,T2,T3>on(String target, Action3<T1,T2,T3> callback, Type param1, Type param2, Type param3)
Registers a handler that will be invoked when the hub method with the specified method name is invoked. |
Subscription |
<T1,T2>on(String target, Action2<T1,T2> callback, Class<T1> param1, Class<T2> param2)
Registers a handler that will be invoked when the hub method with the specified method name is invoked. |
Subscription |
<T1,T2>on(String target, Action2<T1,T2> callback, Type param1, Type param2)
Registers a handler that will be invoked when the hub method with the specified method name is invoked. |
Subscription |
<T1>on(String target, Action1<T1> callback, Class<T1> param1)
Registers a handler that will be invoked when the hub method with the specified method name is invoked. |
Subscription |
<T1>on(String target, Action1<T1> callback, Type param1)
Registers a handler that will be invoked when the hub method with the specified method name is invoked. |
io.reactivex.Single<T> |
<T>invoke(Class<T> returnType, String method, Object[] args)
Invokes a hub method on the server using the specified method name and arguments. |
io.reactivex.Single<T> |
<T>invoke(Type returnType, String method, Object[] args)
Invokes a hub method on the server using the specified method name and arguments. |
io.reactivex.Observable<T> |
<T>stream(Class<T> returnType, String method, Object[] args)
Invokes a streaming hub method on the server using the specified name and arguments. |
io.reactivex.Observable<T> |
<T>stream(Type returnType, String method, Object[] args)
Invokes a streaming hub method on the server using the specified name and arguments. |
void | close() |
java.lang.String |
getConnectionId()
Gets the connections connection |
Hub |
getConnectionState()
Indicates the state of the HubConnection to the server. |
long |
getKeepAliveInterval()
Gets the keep alive interval. |
long |
getServerTimeout()
Gets the server timeout duration. |
io.reactivex.Completable |
invoke(String method, Object[] args)
Invokes a hub method on the server using the specified method name and arguments. |
Subscription |
on(String target, Action callback)
Registers a handler that will be invoked when the hub method with the specified method name is invoked. |
void |
onClosed(OnClosedCallback callback)
Registers a callback to run when the connection is closed. |
void |
remove(String name)
Removes all handlers associated with the method with the specified method name. |
void |
send(String method, Object[] args)
Invokes a hub method on the server using the specified method name. |
void |
setBaseUrl(String url)
Sets a new url for the Hub |
void |
setKeepAliveInterval(long keepAliveIntervalInMilliseconds)
Sets the keep alive interval duration. |
void |
setServerTimeout(long serverTimeoutInMilliseconds)
Sets the server timeout interval for the connection. |
io.reactivex.Completable |
start()
Starts a connection to the server. |
io.reactivex.Completable |
stop()
Stops a connection to the server. |
Inherited Members
Method Details
<T1,T2,T3,T4,T5,T6,T7,T8>on
public Subscription
Registers a handler that will be invoked when the hub method with the specified method name is invoked. Should be used for primitives and non-generic classes.
Parameters:
Returns:
<T1,T2,T3,T4,T5,T6,T7,T8>on
public Subscription
Registers a handler that will be invoked when the hub method with the specified method name is invoked. Should be used for generic classes and Parameterized Collections, like List or Map. A Type can be retrieved using TypeReference<T>
Parameters:
Returns:
<T1,T2,T3,T4,T5,T6,T7>on
public Subscription
Registers a handler that will be invoked when the hub method with the specified method name is invoked. Should be used for primitives and non-generic classes.
Parameters:
Returns:
<T1,T2,T3,T4,T5,T6,T7>on
public Subscription
Registers a handler that will be invoked when the hub method with the specified method name is invoked. Should be used for generic classes and Parameterized Collections, like List or Map. A Type can be retrieved using TypeReference<T>
Parameters:
Returns:
<T1,T2,T3,T4,T5,T6>on
public Subscription
Registers a handler that will be invoked when the hub method with the specified method name is invoked. Should be used for primitives and non-generic classes.
Parameters:
Returns:
<T1,T2,T3,T4,T5,T6>on
public Subscription
Registers a handler that will be invoked when the hub method with the specified method name is invoked. Should be used for generic classes and Parameterized Collections, like List or Map. A Type can be retrieved using TypeReference<T>
Parameters:
Returns:
<T1,T2,T3,T4,T5>on
public Subscription
Registers a handler that will be invoked when the hub method with the specified method name is invoked. Should be used for primitives and non-generic classes.
Parameters:
Returns:
<T1,T2,T3,T4,T5>on
public Subscription
Registers a handler that will be invoked when the hub method with the specified method name is invoked. Should be used for generic classes and Parameterized Collections, like List or Map. A Type can be retrieved using TypeReference<T>
Parameters:
Returns:
<T1,T2,T3,T4>on
public Subscription
Registers a handler that will be invoked when the hub method with the specified method name is invoked. Should be used for primitives and non-generic classes.
Parameters:
Returns:
<T1,T2,T3,T4>on
public Subscription
Registers a handler that will be invoked when the hub method with the specified method name is invoked. Should be used for generic classes and Parameterized Collections, like List or Map. A Type can be retrieved using TypeReference<T>
Parameters:
Returns:
<T1,T2,T3>on
public Subscription
Registers a handler that will be invoked when the hub method with the specified method name is invoked. Should be used for primitives and non-generic classes.
Parameters:
Returns:
<T1,T2,T3>on
public Subscription
Registers a handler that will be invoked when the hub method with the specified method name is invoked. Should be used for generic classes and Parameterized Collections, like List or Map. A Type can be retrieved using TypeReference<T>
Parameters:
Returns:
<T1,T2>on
public Subscription
Registers a handler that will be invoked when the hub method with the specified method name is invoked. Should be used for primitives and non-generic classes.
Parameters:
Returns:
<T1,T2>on
public Subscription
Registers a handler that will be invoked when the hub method with the specified method name is invoked. Should be used for generic classes and Parameterized Collections, like List or Map. A Type can be retrieved using TypeReference<T>
Parameters:
Returns:
<T1>on
public Subscription
Registers a handler that will be invoked when the hub method with the specified method name is invoked. Should be used for primitives and non-generic classes.
Parameters:
Returns:
<T1>on
public Subscription
Registers a handler that will be invoked when the hub method with the specified method name is invoked. Should be used for generic classes and Parameterized Collections, like List or Map. A Type can be retrieved using TypeReference<T>
Parameters:
Returns:
<T>invoke
public Single
Invokes a hub method on the server using the specified method name and arguments.
Parameters:
Returns:
<T>invoke
public Single
Invokes a hub method on the server using the specified method name and arguments. A Type can be retrieved using TypeReference<T>
Parameters:
Returns:
<T>stream
public Observable
Invokes a streaming hub method on the server using the specified name and arguments.
Parameters:
Returns:
<T>stream
public Observable
Invokes a streaming hub method on the server using the specified name and arguments.
Parameters:
Returns:
close
public void close()
getConnectionId
public String getConnectionId()
Gets the connections connectionId. This value will be cleared when the connection is stopped and will have a new value every time the connection is successfully started.
Returns:
getConnectionState
public HubConnectionState getConnectionState()
Indicates the state of the HubConnection to the server.
Returns:
getKeepAliveInterval
public long getKeepAliveInterval()
Gets the keep alive interval.
Returns:
getServerTimeout
public long getServerTimeout()
Gets the server timeout duration.
Returns:
invoke
public Completable invoke(String method, Object[] args)
Invokes a hub method on the server using the specified method name and arguments.
Parameters:
Returns:
on
public Subscription on(String target, Action callback)
Registers a handler that will be invoked when the hub method with the specified method name is invoked.
Parameters:
Returns:
onClosed
public void onClosed(OnClosedCallback callback)
Registers a callback to run when the connection is closed.
Parameters:
remove
public void remove(String name)
Removes all handlers associated with the method with the specified method name.
Parameters:
send
public void send(String method, Object[] args)
Invokes a hub method on the server using the specified method name. Does not wait for a response from the receiver.
Parameters:
setBaseUrl
public void setBaseUrl(String url)
Sets a new url for the HubConnection.
Parameters:
setKeepAliveInterval
public void setKeepAliveInterval(long keepAliveIntervalInMilliseconds)
Sets the keep alive interval duration.
Parameters:
setServerTimeout
public void setServerTimeout(long serverTimeoutInMilliseconds)
Sets the server timeout interval for the connection.
Parameters:
start
public Completable start()
Starts a connection to the server.
Returns:
stop
public Completable stop()
Stops a connection to the server.
Returns: