platform/plugins/client-resources
Andrey Sobolev 99eb2e01ee
Update deps (#2186)
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
2022-07-02 12:30:37 +06:00
..
config initial client-resources implementation 2021-08-07 06:30:10 +02:00
src Clean console.log (#2048) 2022-06-10 16:43:36 +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 Update deps (#2186) 2022-07-02 12:30:37 +06: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)
...