platform/plugins/client-resources
2022-04-29 12:27:17 +07:00
..
config initial client-resources implementation 2021-08-07 06:30:10 +02:00
src CI formatting (#1590) 2022-04-29 12:27:17 +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 CI formatting (#1590) 2022-04-29 12:27:17 +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)
...