deepstreamIO / deepstream.io

deepstream.io server
https://deepstreamio.github.io
MIT License
7.14k stars 381 forks source link

Use deepstream client in node throws error #1075

Closed geohuz closed 4 years ago

geohuz commented 4 years ago

I'm trying to programing a server side client to connect to deepstream server to manager list of task, so I'm using node with @deepstream/client,

import DeepstreamClient from '@deepstream/client'

const dss = new DeepstreamClient('xxx.xxx.xxx.xxx:6020/deepstream')
dss.login()

run the script file with node --experimental-modules taskserver.mjs And I get: TypeError: DeepstreamClient is not a constructor

Am I doing correctly?

yasserf commented 4 years ago

It’s { DeepstreamClient } since the function is not the default export.

import { DeepstreamClient } from '@deepstream/client'

const ds = new DeepstreamClient('xxx.xxx.xxx.xxx:6020/deepstream')
ds.login()