Skip to content

Idea: RPC system #15

Open
Open
@stelcheck

Description

@stelcheck

Note: will flesh out a complete pseudo-code in upcoming weeks.

Based on messages definition, allow for a request/reply type of API.

  1. Should not interfere with messages (e.g. how will harmonize with MessageType.parse?)
  2. Should provide a very lightweight encapsulation
  3. Network-agnostic: for instance, I should be able to make RPC calls go from the server to the client
  4. Timeouts should be possible (e.g timing out requests)

shared/messages/index.ts

// [...]

export enum ServiceIds {
  ServerService
}

// Todo: export decorator?

shared/messages/services/ServerService.ts

import { ServiceIds, Service } from '../'
import MessageRPCService, { RPCResponse } from 'megadata/classes/MessageRPCService'

@Service(ServiceIds.ServerService)
abstract class ServerService extends MessageRPCService {
  public SomeCall(message: MessageType): ReturnMessage;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions