All Projects → codeestX → RxSocketClient

codeestX / RxSocketClient

Licence: Apache-2.0 license
🚀Reactive Socket APIs for Android, Java and Kotlin, powered by RxJava2

Programming Languages

kotlin
9241 projects
java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to RxSocketClient

CleanArchitecture-SocketIO
CleanArchitecture with SocketIo 📡
Stars: ✭ 32 (-30.43%)
Mutual labels:  socket, rxjava2
NoWordsChat
No Words Chat,Just For Fun! Use MVVM,DataBinding,Fresco......
Stars: ✭ 46 (+0%)
Mutual labels:  rxjava2
go-eventserver
A socket server which reads events from an event source and forwards them to the user clients when appropriate
Stars: ✭ 18 (-60.87%)
Mutual labels:  socket
minilib
MiniLib Pascal/Delphi library
Stars: ✭ 49 (+6.52%)
Mutual labels:  socket
android-kick-start-modular
Android Kick Start Project Template Framework FrogoBox || Admob, MVVM Archictecture || Clean Architecture Modularization
Stars: ✭ 16 (-65.22%)
Mutual labels:  rxjava2
ReactiveAwareness
Android library to quickly and easily get the users context using the Awareness API and RxJava
Stars: ✭ 20 (-56.52%)
Mutual labels:  rxjava2
VanGogh
💥 Android view animations powered by RxJava 2
Stars: ✭ 95 (+106.52%)
Mutual labels:  rxjava2
Muvi
Very simple project to show a collection of Movie from MovieDb with a minimalist design
Stars: ✭ 46 (+0%)
Mutual labels:  rxjava2
rx-scheduler-transformer
rxjava scheduler transformer tools for android
Stars: ✭ 15 (-67.39%)
Mutual labels:  rxjava2
Server
The whir.io chat server.
Stars: ✭ 15 (-67.39%)
Mutual labels:  socket
RxBus
Rx event bus based on RxRelay and custom observer
Stars: ✭ 16 (-65.22%)
Mutual labels:  rxjava2
IQFeed.CSharpApiClient
IQFeed.CSharpApiClient is fastest and the most well-designed C# DTN IQFeed socket API connector available
Stars: ✭ 103 (+123.91%)
Mutual labels:  socket
How-to-Deconstruct-Ping-with-C-and-NodeJS
🙈 Simple examples that show how to work with binary headers in C and NodeJS
Stars: ✭ 51 (+10.87%)
Mutual labels:  socket
Pursuit-Core-Android
Pursuit Core Android
Stars: ✭ 45 (-2.17%)
Mutual labels:  rxjava2
xmpp-php
PHP client library for XMPP (Jabber) protocol
Stars: ✭ 33 (-28.26%)
Mutual labels:  socket
socketbox
Write websocket app like as restful api. Inspired by express.
Stars: ✭ 14 (-69.57%)
Mutual labels:  socket
ChatRoom
🎉简易Cli聊天室 - Python Socket实现
Stars: ✭ 153 (+232.61%)
Mutual labels:  socket
aioudp
Asyncio UDP server
Stars: ✭ 21 (-54.35%)
Mutual labels:  socket
socketio
No description or website provided.
Stars: ✭ 23 (-50%)
Mutual labels:  socket
AndroidNetMonitor
This project aims to collect and analyze traffic information of Android.(采集手机发送和接收的报文简要信息,并且根据socket记录每个报文对应哪个手机app)
Stars: ✭ 25 (-45.65%)
Mutual labels:  socket

RxSocketClient

PRs Welcome API License

RxSocketClient, Reactive Socket APIs for Android, Java and Kotlin, powered by RxJava2
RxSocketClient,支持Android,Java和Kotlin的响应式Socket APIs封装,基于RxJava2

RxJava2 Version: 2.1.1

Usage

Step 1. Add the JitPack repository to your build file

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

Step 2. Add the dependency

dependencies {
        compile 'com.github.codeestX:RxSocketClient:v1.0.1'
}

init

SocketClient mClient = RxSocketClient
        .create(new SocketConfig.Builder()
                .setIp(IP)
                .setPort(PORT)
                .setCharset(Charsets.UTF_8)
                .setThreadStrategy(ThreadStrategy.ASYNC)
                .setTimeout(30 * 1000)
                .build())
        .option(new SocketOption.Builder()
                .setHeartBeat(HEART_BEAT, 60 * 1000)
                .setHead(HEAD)
                .setTail(TAIL)
                .build());
value default description
Ip required host address
Port required port number
Charset UTF_8 the charset when encode a String to byte[]
ThreadStrategy Async sending data asynchronously or synchronously
Timeout 0 the timeout of a connection, millisecond
HeartBeat Optional value and interval of heartbeat, millisecond
Head Optional appending bytes at head when sending data, not included heartbeat
Tail Optional appending bytes at last when sending data, not included heartbeat

connect

Disposable ref = mClient.connect()
	... // anything else what you can do with RxJava
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new SocketSubscriber() {
                    @Override
                    public void onConnected() {
                        //onConnected
                        Log.e(TAG, "onConnected");
                    }

                    @Override
                    public void onDisconnected() {
                        //onDisconnected
                        Log.e(TAG, "onDisconnected");
                    }

                    @Override
                    public void onResponse(@NotNull byte[] data) {
                        //receive data
                        Log.e(TAG, Arrays.toString(data));
                    }
                }, new Consumer<Throwable>() {
                    @Override
                    public void accept(Throwable throwable) throws Exception {
                        //onError
                        Log.e(TAG, throwable.toString());
                    }
                });

disconnect

mClient.disconnect();
//or
ref.dispose();

sendData

mClient.sendData(bytes);
//or
mClient.sendData(string);

License

  Copyright (c) 2017 codeestX

  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].