platform/plugins/client-resources
Denis Bykhov c7ca07134a fixes
Signed-off-by: Denis Bykhov <80476319+BykhovDenis@users.noreply.github.com>
2022-01-26 10:30:53 +06: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 Update mention popup. Add svelte-check. Fix warnings. (#854) 2022-01-24 12:25:10 +01: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)
...