Documentation ¶
Index ¶
- type Bus
- type ClientBuilder
- type ClientSocket
- type ClientSocketAcceptor
- type ClientStarter
- type ClientTransportBuilder
- type EnhancedRSocket
- type OptAbstractSocket
- func FireAndForget(fn func(msg payload.Payload)) OptAbstractSocket
- func MetadataPush(fn func(payload payload.Payload)) OptAbstractSocket
- func RequestChannel(fn func(msgs rx.Publisher) rx.Flux) OptAbstractSocket
- func RequestResponse(fn func(msg payload.Payload) rx.Mono) OptAbstractSocket
- func RequestStream(fn func(msg payload.Payload) rx.Flux) OptAbstractSocket
- type OptBalancer
- type RSocket
- type ServerAcceptor
- type ServerBuilder
- type ServerTransportBuilder
- type Start
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bus ¶ added in v0.0.6
type ClientBuilder ¶
type ClientBuilder interface { ClientTransportBuilder // Fragment set fragmentation size which default is 16_777_215(16MB). Fragment(mtu int) ClientBuilder // KeepAlive defines current client keepalive settings. KeepAlive(tickPeriod, ackTimeout time.Duration, missedAcks int) ClientBuilder // DataMimeType is used to set payload data MIME type. // Default MIME type is `application/binary`. DataMimeType(mime string) ClientBuilder // MetadataMimeType is used to set payload metadata MIME type. // Default MIME type is `application/binary`. MetadataMimeType(mime string) ClientBuilder // SetupPayload set the setup payload. SetupPayload(setup payload.Payload) ClientBuilder // OnClose register handler when client socket closed. OnClose(fn func()) ClientBuilder // Acceptor set acceptor for RSocket client. Acceptor(acceptor ClientSocketAcceptor) ClientTransportBuilder // contains filtered or unexported methods }
ClientBuilder can be used to build a RSocket client.
func Connect ¶
func Connect() ClientBuilder
Connect create a new RSocket client builder with default settings.
type ClientSocket ¶
ClientSocket is Client Side of a RSocket socket. Sends Frames to a RSocket Server.
type ClientSocketAcceptor ¶
ClientSocketAcceptor is alias for RSocket handler function.
type ClientStarter ¶
type ClientStarter interface { // Start start a client socket. Start() (ClientSocket, error) }
ClientStarter can be used to start a client.
type ClientTransportBuilder ¶
type ClientTransportBuilder interface { // Transport set Transport for current RSocket client. // URI is used to create RSocket Transport: // Example: // "tcp://127.0.0.1:7878" means a TCP RSocket transport. // "ws://127.0.0.1:8080/a/b/c" means a Websocket RSocket transport. (NOTICE: Websocket will be supported in the future). Transport(uri string) ClientStarter // Transports set transports with load balancer. // Client will watch discovery and change current transports. // You can custom balancer options use functions: WithInitTransports, WithQuantile, WithPendings and WithActives. Transports(discovery <-chan []string, options ...OptBalancer) ClientStarter }
ClientTransportBuilder is used to build a RSocket client with custom Transport string.
type EnhancedRSocket ¶ added in v0.0.5
type EnhancedRSocket interface { io.Closer RSocket // OnClose bind handler when socket disconnected. OnClose(fn func()) }
EnhancedRSocket is a RSocket which support more events.
type OptAbstractSocket ¶
type OptAbstractSocket func(*abstractRSocket)
OptAbstractSocket is option for abstract socket.
func FireAndForget ¶
func FireAndForget(fn func(msg payload.Payload)) OptAbstractSocket
FireAndForget register request handler for FireAndForget.
func MetadataPush ¶
func MetadataPush(fn func(payload payload.Payload)) OptAbstractSocket
MetadataPush register request handler for MetadataPush.
func RequestChannel ¶
func RequestChannel(fn func(msgs rx.Publisher) rx.Flux) OptAbstractSocket
RequestChannel register request handler for RequestChannel.
func RequestResponse ¶
func RequestResponse(fn func(msg payload.Payload) rx.Mono) OptAbstractSocket
RequestResponse register request handler for RequestResponse.
func RequestStream ¶
func RequestStream(fn func(msg payload.Payload) rx.Flux) OptAbstractSocket
RequestStream register request handler for RequestStream.
type OptBalancer ¶ added in v0.0.4
type OptBalancer func(opts *balancerOpts)
OptBalancer can be used to set options for balancer.
func WithActives ¶ added in v0.0.4
func WithActives(min, max int) OptBalancer
WithActives limit amount of active sockets for a balancer. (default: 3 ~ 100)
func WithInitTransports ¶ added in v0.0.4
func WithInitTransports(uris ...string) OptBalancer
WithInitTransports sets initial transport URI.
func WithPendings ¶ added in v0.0.4
func WithPendings(min, max float64) OptBalancer
WithPendings sets pendings range for a balancer. (default: 1.0 ~ 2.0)
func WithQuantile ¶ added in v0.0.4
func WithQuantile(lower, higher float64) OptBalancer
WithQuantile sets quantile range of a balancer. (default: 0.2 ~ 0.8)
type RSocket ¶
type RSocket interface { // FireAndForget is a single one-way message. FireAndForget(msg payload.Payload) // MetadataPush sends asynchronous Metadata frame. MetadataPush(msg payload.Payload) // RequestResponse request single response. RequestResponse(msg payload.Payload) rx.Mono // RequestStream request a completable stream. RequestStream(msg payload.Payload) rx.Flux // RequestChannel request a completable stream in both directions. RequestChannel(msgs rx.Publisher) rx.Flux }
RSocket is a contract providing different interaction models for RSocket protocol.
func NewAbstractSocket ¶
func NewAbstractSocket(opts ...OptAbstractSocket) RSocket
NewAbstractSocket returns an abstract implementation of RSocket. You can specify the actual implementation of any request.
type ServerAcceptor ¶
type ServerAcceptor = func(setup payload.SetupPayload, sendingSocket EnhancedRSocket) RSocket
ServerAcceptor is alias for server accepter.
type ServerBuilder ¶
type ServerBuilder interface { // Fragment set fragmentation size which default is 16_777_215(16MB). Fragment(mtu int) ServerBuilder // Acceptor register server acceptor which is used to handle incoming RSockets. Acceptor(acceptor ServerAcceptor) ServerTransportBuilder }
ServerBuilder can be used to build a RSocket server.
func Receive ¶
func Receive() ServerBuilder
Receive receives server connections from client RSockets.
type ServerTransportBuilder ¶
type ServerTransportBuilder interface { // Transport specify transport string. Transport(transport string) Start }
ServerTransportBuilder is used to build a RSocket server with custom Transport string.