Skip to content

Commit

Permalink
3.0.0-dev.15 client default use TerminalLogger
Browse files Browse the repository at this point in the history
  • Loading branch information
King Wang committed Jun 6, 2021
1 parent db8f7d4 commit eff5df0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tsrpc",
"version": "3.0.0-dev.14",
"version": "3.0.0-dev.15",
"description": "TSRPC 3.x (both support HTTP and WebSocket)",
"main": "index.cjs",
"exports": {
Expand Down
2 changes: 2 additions & 0 deletions src/client/http/HttpClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import https from "https";
import { EncodeOutput } from "tsbuffer";
import { ApiService, BaseClient, BaseClientOptions, defaultBaseClientOptions, MsgService, PendingApiItem, TransportDataUtil, TransportOptions } from "tsrpc-base-client";
import { ApiReturn, BaseServiceType, ServiceProto, TsrpcError, TsrpcErrorType } from "tsrpc-proto";
import { TerminalColorLogger } from "../../server/models/TerminalColorLogger";

/**
* Client for TSRPC HTTP Server.
Expand Down Expand Up @@ -188,6 +189,7 @@ export class HttpClient<ServiceType extends BaseServiceType> extends BaseClient<
const defaultHttpClientOptions: HttpClientOptions = {
...defaultBaseClientOptions,
server: 'http://localhost:3000',
logger: new TerminalColorLogger(),
json: false,
jsonPrune: true
}
Expand Down
6 changes: 4 additions & 2 deletions src/client/ws/WsClient.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { BaseClient, BaseClientOptions, defaultBaseClientOptions, PendingApiItem, TransportOptions } from "tsrpc-base-client";
import { BaseServiceType, ServiceProto, TsrpcError, TsrpcErrorType } from "tsrpc-proto";
import WebSocket from 'ws';
import { TerminalColorLogger } from "../../server/models/TerminalColorLogger";

/**
* Client for TSRPC WebSocket Server.
Expand Down Expand Up @@ -190,12 +191,13 @@ export class WsClient<ServiceType extends BaseServiceType> extends BaseClient<Se

const defaultWsClientOptions: WsClientOptions = {
...defaultBaseClientOptions,
server: 'ws://localhost:3000'
server: 'ws://localhost:3000',
logger: new TerminalColorLogger(),
}

export interface WsClientOptions extends BaseClientOptions {
/** Server URL */
server: string;
server: string,
}

export enum WsClientStatus {
Expand Down

0 comments on commit eff5df0

Please sign in to comment.