All Projects → jacek-marchwicki → Javawebsocketclient

jacek-marchwicki / Javawebsocketclient

RxJava WebSocket library for Java and Android

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Javawebsocketclient

Rxwebsocket
An auto reconnection-webSocket build with okhttp and rxJava
Stars: ✭ 678 (+260.64%)
Mutual labels:  rxjava, websocket, websockets, okhttp
Django Sockpuppet
Build reactive applications with the django tooling you already know and love.
Stars: ✭ 225 (+19.68%)
Mutual labels:  reactive, websocket, websockets
Webfluxtemplate
Spring Webflux template application with working Spring Security, Web-sockets, Rest, Web MVC, and Authentication with JWT.
Stars: ✭ 107 (-43.09%)
Mutual labels:  reactive, websocket, websockets
Android Okgraphql
Reactive GraphQl client for Android
Stars: ✭ 64 (-65.96%)
Mutual labels:  rxjava, reactive, okhttp
Knotx
Knot.x is a highly-efficient and scalable integration framework designed to build backend APIs
Stars: ✭ 119 (-36.7%)
Mutual labels:  rxjava, reactive
Php Wss
Web-socket server/client with multi-process and parse templates support on server and send/receive options on client
Stars: ✭ 117 (-37.77%)
Mutual labels:  websocket, websockets
Claws
Awesome WebSocket CLient - an interactive command line client for testing websocket servers
Stars: ✭ 187 (-0.53%)
Mutual labels:  websocket, websockets
Rxjava Spring Boot Starter
RxJava Spring MVC integration
Stars: ✭ 180 (-4.26%)
Mutual labels:  rxjava, reactive
Linkphp
基于swoole一款高性能多进程常驻内存型全栈框架,内置WebSocket服务器、服务治理PhpRpc功能,不依赖传统的 PHP-FPM,可以用于构建高性能的Web系统、API、中间件、基础服务等等。
Stars: ✭ 101 (-46.28%)
Mutual labels:  websocket, websockets
Okhttp Okgo
OkGo - 3.0 震撼来袭,该库是基于 Http 协议,封装了 OkHttp 的网络请求框架,比 Retrofit 更简单易用,支持 RxJava,RxJava2,支持自定义缓存,支持批量断点下载管理和批量上传管理功能
Stars: ✭ 10,407 (+5435.64%)
Mutual labels:  rxjava, okhttp
Bolt Js
A framework to build Slack apps using JavaScript
Stars: ✭ 1,971 (+948.4%)
Mutual labels:  websocket, websockets
Vertx Mqtt
Vert.x MQTT
Stars: ✭ 117 (-37.77%)
Mutual labels:  rxjava, reactive
Spec
The AsyncAPI specification allows you to create machine-readable definitions of your asynchronous APIs.
Stars: ✭ 1,860 (+889.36%)
Mutual labels:  reactive, websockets
Tap Tap Adventure
Tap Tap Adventure is a massively online 2D MMORPG set in the medieval times with twists.
Stars: ✭ 123 (-34.57%)
Mutual labels:  websocket, websockets
Dagger2
Kotlin Dagger2 example project
Stars: ✭ 145 (-22.87%)
Mutual labels:  rxjava, okhttp
Kingtv
📺 高仿全民直播(全民TV),项目采用 MVP + RXJava + Retrofit + OKHttp + Material Design + Dagger2 + Base + Glide + GreenDao构建。因为全民TV已经凉了,导致App已经连不上。所以本项目已暂停维护。仅供学习。 推荐MVPFrame: https://github.com/jenly1314/MVPFrame 和你值得拥有的MVVMFrame快速开发框架: https://github.com/jenly1314/MVVMFrame
Stars: ✭ 1,594 (+747.87%)
Mutual labels:  rxjava, okhttp
Websocket
WSServer is a fast, configurable, and extendable WebSocket Server for UNIX systems written in C (C11).
Stars: ✭ 144 (-23.4%)
Mutual labels:  websocket, websockets
Ws Tcp Relay
A simple relay between WebSocket clients and TCP servers
Stars: ✭ 186 (-1.06%)
Mutual labels:  websocket, websockets
Rsocket Java
Java implementation of RSocket
Stars: ✭ 2,099 (+1016.49%)
Mutual labels:  rxjava, reactive
Sandstone
PHP microframework designed to build a RestApi working together with a websocket server. Build a real time RestApi!
Stars: ✭ 98 (-47.87%)
Mutual labels:  websocket, websockets

JavaWebsocketClient also for Android

JavaWebsocketClient is library is simple library for Websocket connection in rx for java and Android. It is designed to be fast and fault tolerant.

Currently we use okhttp3 for websocket connection because okhttp3 is simple and well tested solution.

Build Status

Release

Presentation of example

Content of the package

  • Example websockets server python twisted server
  • Rx-java websocket client library websockets-rxjava/
  • Rx-java websocket android example websockets-rxjava-example/

Reactive example

How to connect to server:

final Request request = new Request.Builder()
        .get()
        .url("ws://10.10.0.2:8080/ws")
        .build();
final Subscription subscribe = new RxWebSockets(new OkHttpClient(), request)
        .webSocketObservable()
        .subscribe(new Action1<RxEvent>() {
            @Override
            public void call(RxEvent rxEvent) {
                System.out.println("Event: " + rxEvent.toString());
            }
        });
Thread.sleep(10000);
subscribe.unsubscribe();

Send message on connected:

final Subscription subscription = new RxWebSockets(newWebSocket, request)
        .webSocketObservable()
        .subscribe(new Action1<RxEvent>() {
            @Override
            public void call(RxEvent rxEvent) {
                if (rxEvent instanceof RxEventConnected) {
                    Observable.just("response")
                            .compose(RxMoreObservables.sendMessage((RxEventConnected) rxEvent))
                            .subscribe();
                }
            }
        });
Thread.sleep(1000);
subscription.unsubscribe();

For examples look:

Rx-java with json parser

class YourMessage {
    public String response;
    public String error;
}

final Request request = new Request.Builder()
        .get()
        .url("ws://10.10.0.2:8080/ws")
        .build();
final RxWebSockets rxWebSockets = new RxWebSockets(new OkHttpClient(), request)
final ObjectSerializer serializer = new GsonObjectSerializer(new Gson(), Message.class)
final RxObjectWebSockets webSockets = new RxObjectWebSockets(rxWebSockets), serializer);
final Subscription subscription = webSockets.webSocketObservable()
        .compose(MoreObservables.filterAndMap(RxObjectEventMessage.class))
        .compose(RxObjectEventMessage.filterAndMap(YourMessage.class))
        .subscribe(new Action1<YourMessage>() {
            @Override
            public void call(YourMessage yourMessage) {
                System.out.println("your message: " + yourMessage.response);
            }
        });
Thread.sleep(1000);
subscription.unsubscribe();

Run example from gradle

To run example first run websocket server, than update url to your host in:

./gradlew :websockets-rxjava-example:installDebug

How to add to your project

to your gradle file:

repositories {
    maven { url "https://jitpack.io" }
}

dependencies {

    // snapshot version
    compile 'com.github.jacek-marchwicki:JavaWebsocketClient:master-SNAPSHOT'

    // or use specific version
    compile 'com.github.jacek-marchwicki:JavaWebsocketClient:<look-on-release-tab>'
}

License

Copyright [2015] [Jacek Marchwicki <[email protected]>]

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

	http://www.apache.org/licenses/LICENSE-2.0
    

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].