RocketChat / RocketChat/Rocket.Chat.js.SDK
driver.connect() not working
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 146
- Forks
- 99
- Avg merge
- 7h 59m
- Merged PRs (30d)
- 17
Description
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)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with driver.ts:103 and the client.js:43 stack frames, then reproduce driver.connect() in the reported React setup. Trace why the browser bundle reaches net.connect and determine the supported way to enable realtime features. Done means the documented usage works without the reported TypeError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, react, typescript
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100