Skip to content

driver.connect() not working #136

@officialabdulrehman

Description

@officialabdulrehman

Hi there! I hope you are having a nice day.

I have been trying to use @rocket.chat/sdk in my React app.

SERVER DETAILS

Deployment
Version
3.15.0
Deployment ID
RFJ4fpYQA2vC2cNLA
Apps Engine Version
1.26.0
Node Version
v12.22.1
Database Migration
225 (June 11, 2021 9:25 AM)
MongoDB
4.0.24 / mmapv1 (oplog Enabled)
Commit Details
HEAD: (55457025d)
Branch: HEAD
PID
23

I have been able to interact with the REST-api with { api } but the driver { driver } doesn't work.
How can I use realtime features with this sdk

`import {
driver,
api
} from '@rocket.chat/sdk';

api.login({username: USER, password: PASS}).then(info => {
api.get('subscriptions.get')
}) // THIS WORKS

driver.connect() // THIS DOESN'T WORK
`

ERROR

Uncaught (in promise) TypeError: net.connect is not a function
at new Client (client.js:43)
at DDP.connect (ddp.js:61)
at new DDP (ddp.js:54)
at Asteroid.push../node_modules/asteroid/dist/asteroid.node.js.Asteroid._init (asteroid.node.js:366)
at new Asteroid (asteroid.node.js:26)
at driver.ts:107
at new Promise ()
at Object.connect (driver.ts:103)
at App (App.js:21)
at renderWithHooks (react-dom.development.js:14985)
at mountIndeterminateComponent (react-dom.development.js:17811)
at beginWork (react-dom.development.js:19049)
at beginWork$1 (react-dom.development.js:23940)
at performUnitOfWork (react-dom.development.js:22776)
at workLoopSync (react-dom.development.js:22707)
at renderRootSync (react-dom.development.js:22670)
at performSyncWorkOnRoot (react-dom.development.js:22293)
at scheduleUpdateOnFiber (react-dom.development.js:21881)
at updateContainer (react-dom.development.js:25482)
at react-dom.development.js:26021
at unbatchedUpdates (react-dom.development.js:22431)
at legacyRenderSubtreeIntoContainer (react-dom.development.js:26020)
at Object.render (react-dom.development.js:26103)
at Module. (index.js:7)
at Module../src/index.js (index.js:18)
at webpack_require (bootstrap:856)
at fn (bootstrap:150)
at Object.1 (reportWebVitals.js:14)
at webpack_require (bootstrap:856)
at checkDeferredModules (bootstrap:45)
at Array.webpackJsonpCallback [as push] (bootstrap:32)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions