https://github.com/delight-rpc/http-client
🌲 The HTTP client library of delight-rpc.
https://github.com/delight-rpc/http-client
browser esm library nodejs npm-package typescript
Last synced: 2 months ago
JSON representation
🌲 The HTTP client library of delight-rpc.
- Host: GitHub
- URL: https://github.com/delight-rpc/http-client
- Owner: delight-rpc
- License: mit
- Created: 2021-02-24T03:39:08.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2026-02-26T16:14:44.000Z (4 months ago)
- Last Synced: 2026-02-26T17:31:38.778Z (4 months ago)
- Topics: browser, esm, library, nodejs, npm-package, typescript
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/@delight-rpc/http-client
- Size: 1.9 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# @delight-rpc/http-client
The HTTP client library of [delight-rpc],
it needs to be used with the server implementation [@delight-rpc/http-server].
[delight-rpc]: https://www.npmjs.com/package/delight-rpc
[@delight-rpc/http-server]: https://www.npmjs.com/package/@delight-rpc/http-server
## Install
```sh
npm install --save @delight-rpc/http-client
# or
yarn add @delight-rpc/http-client
```
## Usage
```ts
interface IAPI {
echo(message: string): string
}
const [client] = createClient({
server: 'http://localhost:8080'
, keepalive: true
})
await client.echo('hello')
```
## API
```ts
interface IClientOptions {
server: string
timeout?: number
keepalive?: boolean
basicAuth?: {
username: string
password: string
}
}
```
### createClient
```ts
function createClient(
clientOptions: IClientOptions
, options?: {
parameterValidators?: DelightRPC.ParameterValidators
expectedVersion?: string
channel?: string
}
): [client: DelightRPC.ClientProxy, close: () => void]
```
### createBatchClient
```ts
function createBatchClient(
clientOptions: IClientOptions
, options?: {
expectedVersion?: string
channel?: string
}
): [client: DelightRPC.BatchClient, close: () => void]