An open API service indexing awesome lists of open source software.

https://github.com/mtamme/signalr-client

An extensible asynchronous SignalR client for Java.
https://github.com/mtamme/signalr-client

asynchronous java signalr-client

Last synced: 4 months ago
JSON representation

An extensible asynchronous SignalR client for Java.

Awesome Lists containing this project

README

          

# signalr-client

An extensible asynchronous SignalR client for Java.

**This is currently a prototype and therefore not applicable for production use!**

## Persistent Connections API

```java
final PersistentConnection connection = new PersistentConnection(
"http://localhost/signalr",
new WebSocketTransport(),
new JacksonFactory());

connection.addConnectionListener(new ConnectionAdapter() {
@Override
public void onReceived(final String message) {
System.out.println(message);
}
});
final Promise promise = connection.start();

Promises.await(promise);
final Scanner scanner = new Scanner(System.in);

while (scanner.hasNextLine()) {
final String line = scanner.nextLine();

connection.send(line);
}
```

## Hubs API

```java
final HubConnection connection = new HubConnection(
"http://localhost/signalr",
new WebSocketTransport(),
new GsonFactory());
final HubProxy proxy = connection.newHubProxy("hub");

proxy.register("update", Update.class, new HubCallback() {
@Override
public void onInvoke(final Update update) {
System.out.println(update);
}
});
final Promise promise = connection.start().then(new Compose() {
@Override
protected Promise doCompose(final Void value) throws Exception {
return proxy.invoke("joinUpdateGroup", Void.class);
}
});

Promises.await(promise);
```

## Extensibility

# Copyright

Copyright © Martin Tamme. See LICENSE for details.