platform/plugins/client-resources
Denis Bykhov 0d2221e567
Fix mis-matching dependencies (#1152)
Signed-off-by: Denis Bykhov <80476319+BykhovDenis@users.noreply.github.com>
2022-03-17 12:07:47 +07:00
..
config initial client-resources implementation 2021-08-07 06:30:10 +02:00
src fixes 2022-01-26 10:30:53 +06: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 Fix mis-matching dependencies (#1152) 2022-03-17 12:07:47 +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)
...