• Stars
    star
    504
  • Rank 87,537 (Top 2 %)
  • Language
    Go
  • License
    Apache License 2.0
  • Created over 7 years ago
  • Updated 10 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

rsocket-go implementation

rsocket-go

logo

GitHub Workflow Status codecov Go Report Card GoDoc License GitHub Release

rsocket-go is an implementation of the RSocket protocol in Go.

Features

  • Design For Golang.
  • Thin reactive-streams implementation.
  • Simulate Java SDK API.
  • Fast CLI (Compatible with https://github.com/rsocket/rsocket-cli).
    • Installation: go get github.com/rsocket/rsocket-go/cmd/rsocket-cli
    • Example: rsocket-cli --request -i hello_world --setup setup_me tcp://127.0.0.1:7878

Install

Minimal go version is 1.11.

$ go get -u github.com/rsocket/rsocket-go

Quick Start

Start an echo server

package main

import (
	"context"
	"log"

	"github.com/rsocket/rsocket-go"
	"github.com/rsocket/rsocket-go/payload"
	"github.com/rsocket/rsocket-go/rx/mono"
)

func main() {
	err := rsocket.Receive().
		Acceptor(func(ctx context.Context, setup payload.SetupPayload, sendingSocket rsocket.CloseableRSocket) (rsocket.RSocket, error) {
			// bind responder
			return rsocket.NewAbstractSocket(
				rsocket.RequestResponse(func(msg payload.Payload) mono.Mono {
					return mono.Just(msg)
				}),
			), nil
		}).
		Transport(rsocket.TCPServer().SetAddr(":7878").Build()).
		Serve(context.Background())
	log.Fatalln(err)
}

Connect to echo server

package main

import (
	"context"
	"log"

	"github.com/rsocket/rsocket-go"
	"github.com/rsocket/rsocket-go/payload"
)

func main() {
	// Connect to server
	cli, err := rsocket.Connect().
		SetupPayload(payload.NewString("Hello", "World")).
		Transport(rsocket.TCPClient().SetHostAndPort("127.0.0.1", 7878).Build()).
		Start(context.Background())
	if err != nil {
		panic(err)
	}
	defer cli.Close()
	// Send request
	result, err := cli.RequestResponse(payload.NewString("你好", "世界")).Block(context.Background())
	if err != nil {
		panic(err)
	}
	log.Println("response:", result)
}

NOTICE: more server examples are Here

Advanced

rsocket-go provides TCP/Websocket transport implementations by default. Since v0.6.0, you can use core package to implement your own RSocket transport. I created an example project which show how to implement an unofficial QUIC transport. You can see rsocket-transport-quic if you are interested.

TODO

  • Wiki
  • UT: 90% coverage

More Repositories

1

rsocket-java

Java implementation of RSocket
Java
2,354
star
2

rsocket

RSocket Protocol Definition
1,837
star
3

rsocket-js

JavaScript implementation of RSocket
TypeScript
593
star
4

rsocket-kotlin

RSocket Kotlin multi-platform implementation
Kotlin
545
star
5

rsocket-cpp

C++ implementation of RSocket
C++
253
star
6

rsocket-net

.NET implementation of RSocket
C#
251
star
7

rsocket-rust

RSocket Rust Implementation using Tokio
Rust
205
star
8

rsocket-rpc-java

Standard RSocket RPC Java Implementation
Java
172
star
9

rsocket-swift

Swift implementation of RSocket Protocol
Swift
76
star
10

rsocket-py

RSocket implementation in Python
Python
76
star
11

rsocket-cli

Command-line client for ReactiveSocket
Kotlin
71
star
12

rsocket-chrome-devtools

RSocket Chrome Dev Tools
TypeScript
42
star
13

rsocket-dart

Dart implementation of RSocket
Dart
31
star
14

rsocket-rpc-js

Standard RSocket RPC Implementation
JavaScript
29
star
15

rsocket-transport-akka

Akka TCP and WebSocket transports for RSocket
Java
28
star
16

rsocket-demo-android-java8

RSocket Android Demo
Kotlin
23
star
17

rsocket-wireshark

Wireshark Plugin for RSocket
C
19
star
18

rsocket-rpc-kotlin

Standard RSocket RPC Kotlin Implementation
Kotlin
19
star
19

rsocket-rpc-net

Standard RSocket RPC .NET Implementation
C#
17
star
20

rsocket-rpc-go

RSocket RPC Golang
Go
15
star
21

rsocket-php

RSocket PHP implementation using ReactPHP
PHP
10
star
22

rsocket-tck

Technology Compatibility Kit (TCK) for RSocket implementations
Kotlin
10
star
23

rsocket-transport-aeron

Aeron Transport for RSocket
Java
10
star
24

ewma

Exponentially Weighted Moving Average
JavaScript
10
star
25

rsocket-rb

Ruby
8
star
26

rsocket-website

rsocket.io website
MDX
7
star
27

bomberman-workshop

JavaScript
7
star
28

rsocket-jmeter

RSocket JMeter Plugin
Java
3
star
29

tsc

RSocket Technical Steering Committee (TSC)
3
star
30

rsocket-c

C implementation of RSocket
3
star
31

rsocket-tck-server

RSocket TCK Server
Kotlin
2
star
32

gradle-nebula-plugin-rsocket

Groovy
1
star
33

rsocket-artwork

RSocket Logos
1
star
34

.github

Template repository for rsocket projects, includes typical README + labels
1
star