@Override public void get(KContentKey[] keys, KCallback<String[]> callback) { GetRequest getRequest = new GetRequest(); getRequest.keys = keys; getRequest.id = nextKey(); _callbacks.put(getRequest.id, callback); WebSockets.sendText(getRequest.json(), _client.getChannel(), null); }
@Override public void put(KContentPutRequest request, KCallback<Throwable> error) { PutRequest putRequest = new PutRequest(); putRequest.request = request; putRequest.id = nextKey(); _callbacks.put(putRequest.id, error); WebSockets.sendText(putRequest.json(), _client.getChannel(), null); }
@Override public void atomicGetIncrement(KContentKey key, KCallback<Short> callback) { AtomicGetIncrementRequest atomicGetRequest = new AtomicGetIncrementRequest(); atomicGetRequest.id = nextKey(); atomicGetRequest.key = key; _callbacks.put(atomicGetRequest.id, callback); WebSockets.sendText(atomicGetRequest.json(), _client.getChannel(), null); }
@Override public void send(KMessage msg) { _localEventListeners.dispatch(msg); WebSockets.sendText(msg.json(), _client.getChannel(), null); }