RpcServer

automorph.RpcServer
See theRpcServer companion object

RPC server.

Used to serve remote API requests and invoke bound API methods to process them.

Automatically derives remote API bindings for existing API instances.

Type parameters

Codec

message codec plugin type

Context

RPC message context type

Effect

effect type

Node

message node type

Value parameters

functions

bound RPC functions

handler

RPC request handler

rpcProtocol

RPC protocol plugin

transport

server transport protocol plugin

Attributes

Constructor

Creates a RPC server with specified protocol and transport plugins supporting corresponding message context type.

Companion
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def close(): Effect[RpcServer[Node, Codec, Effect, Context]]

Stops this server freeing the underlying resources.

Stops this server freeing the underlying resources.

Attributes

Returns

passive RPC server

def discovery(discovery: Boolean): RpcServer[Node, Codec, Effect, Context]

Enable or disable automatic provision of service discovery via RPC functions returning bound API schema.

Enable or disable automatic provision of service discovery via RPC functions returning bound API schema.

Value parameters

discovery

service discovery enabled

Attributes

Returns

RPC server

def init(): Effect[RpcServer[Node, Codec, Effect, Context]]

Starts this server to process incoming requests.

Starts this server to process incoming requests.

Attributes

Returns

active RPC server

Inherited methods

inline def bind[Api <: AnyRef](api: Api, mapName: String => Iterable[String]): RpcServer[Node, Codec, Effect, Context]

Creates a copy of this server with added RPC bindings for all public methods of the specified API instance.

Creates a copy of this server with added RPC bindings for all public methods of the specified API instance.

The binding generation fails if any public API method has one of the following properties:

  • does not return the specified effect type
  • is overloaded
  • has type parameters
  • is inline

Bindings API methods using the names identical to already existing bindings replaces the existing bindings with the new bindings.

If the last parameter of bound method is of Context type or returns a context function accepting the Context type the server-supplied ''request context'' is passed to the bound method or the returned context function as its last argument.

Bound API methods are exposed as RPC functions with their names transformed via the mapName function.

Type parameters

Api

API type (only member methods of this type are exposed)

Value parameters

api

API instance

mapName

maps bound API method name to the exposed RPC function names (empty result causes the method not to be exposed)

Attributes

Returns

RPC request server with specified API bindings

Throws
IllegalArgumentException

if invalid public methods are found in the API type

Inherited from:
ServerBind (hidden)
inline def bind[Api <: AnyRef](api: Api): RpcServer[Node, Codec, Effect, Context]

Creates a copy of this server with added RPC bindings for all public methods of the specified API instance.

Creates a copy of this server with added RPC bindings for all public methods of the specified API instance.

The binding generation fails if any public API method has one of the following properties:

  • does not return the specified effect type
  • is overloaded
  • has type parameters
  • is inline

Bindings API methods using the names identical to already existing bindings replaces the existing bindings with the new bindings.

If the last parameter of bound method is of Context type or returns a context function accepting the Context type the server-supplied ''request context'' is passed to the bound method or the returned context function as its last argument.

Type parameters

Api

API type (only member methods of this type are exposed)

Value parameters

api

API instance

Attributes

Returns

RPC request server with specified API bindings

Throws
IllegalArgumentException

if invalid public methods are found in the API type

Inherited from:
ServerBind (hidden)

Attributes

Inherited from:
Product

Attributes

Inherited from:
Product