platform/plugins/client-resources
Andrey Sobolev c8dde57123
UBERF-9137: Fix Support for suspended installations (#7667)
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
2025-01-15 23:23:23 +07:00
..
config
src UBERF-9137: Fix Support for suspended installations (#7667) 2025-01-15 23:23:23 +07:00
.eslintrc.js
.npmignore
CHANGELOG.json
CHANGELOG.md
jest.config.js
package.json Try snappy compression (#7603) 2025-01-10 22:55:15 +07:00
readme.md
tsconfig.json

Overview

Package allow to create a client to interact with running platform.

Usage

  import clientResources from '@hcengineering/client-resources'
  import core, { Client } from '@hcengineering/core'

  // ...

  const token = ... // Token obtained somehow.

  const connection: Client = await (await clientResources()).function.GetClient(token, transactorUrl)

  // Now client is usable

  // Use close, to shutdown connection.
  await connection.close()

Node JS

For NodeJS environment it is required to configure ClientSocketFactory using 'ws' package.

// We need to override default WebSocket factory with 'ws' one.
setMetadata(client.metadata.ClientSocketFactory, (url) => new WebSocket(url))

const connection: Client = await (await clientResources()).function.GetClient(token, transactorUrl)
...