Open
Description
Note: will flesh out a complete pseudo-code in upcoming weeks.
Based on messages definition, allow for a request/reply type of API.
- Should not interfere with messages (e.g. how will harmonize with MessageType.parse?)
- Should provide a very lightweight encapsulation
- Network-agnostic: for instance, I should be able to make RPC calls go from the server to the client
- 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;
}