platform/plugins/client-resources
Andrey Sobolev 4187fecb0e
Upgrade rush/heft (#1480)
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
2022-04-21 15:51:16 +07:00
..
config initial client-resources implementation 2021-08-07 06:30:10 +02:00
src Separate tracker deployment (#1245) 2022-04-01 12:57:22 +07:00
.eslintrc.js Enable ESLint/prettier (#389) 2021-12-01 10:27:29 +01:00
.npmignore initial client-resources implementation 2021-08-07 06:30:10 +02:00
CHANGELOG.json Expose connect from client-resources (#299) 2021-11-09 12:38:30 +01:00
CHANGELOG.md Expose connect from client-resources (#299) 2021-11-09 12:38:30 +01:00
package.json Upgrade rush/heft (#1480) 2022-04-21 15:51:16 +07:00
readme.md Allow Use client from client-resources from NodeJS (#545) 2021-12-06 17:57:35 +01:00
tsconfig.json add dev-client-resources 2021-08-07 09:04:30 +02:00

Overview

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

Usage

  import clientResources from '@anticrm/client-resources'
  import core, { Client } from '@anticrm/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 enviornment 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)
...