Comments (20)
Here is the precise line of code: sub = Observable.interval(timeout).subscribe(_ => ws.send(null));
Is there a reason why it's sending null?
from botframework-directlinejs.
Hi Team,
same here... just a simple test:
componentDidMount() {
let directLine = new DirectLine({
token: "_sdWTnasdasdasd...."
});
console.log("mounted");
directLine.postActivity({
from: { id: 'myUserId', name: 'Timo' }, // required (from.name is optional)
type: 'message',
text: '123'
}).subscribe(
id => console.log("Posted activity, assigned ID ", id),
error => console.log("Error posting activity", error)
);
directLine.activity$
.filter(activity => activity.type === 'message')
.subscribe(
message => console.log("received message ", message)
);
}
error is Unsupported data type in WebSocket.send 124:10
from botframework-directlinejs.
I'm surprised no other people are having this issue.
from botframework-directlinejs.
Perhaps its because of npm / node version ?!? I am using node 8.2.1 and npm 5.3.0 ....
from botframework-directlinejs.
I'm using v8.3.0. It also gave a problem with 6.9.1. I'm having an issue changing node versions now, I actually had to uninstall it completely because something broke. But according the comments of that Observable.interval(timeout).subscribe(_ => ws.send(null));, it's there because of some chrome issue. So I'm having this issue on iOS and Android, not in web.
from botframework-directlinejs.
I don't see any reason it couldn't send {}
instead of null
, would that fix the problem with React Native?
@dandriscoll periodically DirectLineJS sends empty messages up the WebSocket as a way of helping Chrome notice if the connection is broken so that we can reconnect. Right now we send null
but are contemplating changing this to {}
because React Native's WebSocket
implementation doesn't allow us to send null
. I assume you don't check the incoming messages on your end, but I want to be careful not to break anything.
from botframework-directlinejs.
Another alternative is to make this behavior optional. But I think it might be generally useful for any WebSocket implementation that, like Chrome's, is a little sleepy about noticing WebSocket disconnections.
from botframework-directlinejs.
Can you send an empty string? That's what the service is expecting.
from botframework-directlinejs.
I think so. Out of curiosity, does the service do anything with non-empty strings?
React Native people, can you try changing that null
to ""
and see if it works?
from botframework-directlinejs.
Right now nothing, but ""
and null
are protected from future changes in a way that other values aren't.
from botframework-directlinejs.
Got it. Okay, let's wait to hear from the React Native people and then I'll make the change.
from botframework-directlinejs.
@grootendorste @tschnoelzer we are waiting for your feedback on his one.
from botframework-directlinejs.
Hi I'll try tonight, sorry I wasn't at my laptop for a while.
from botframework-directlinejs.
@grootendorste @tschnoelzer any news for us, React Native folks?
from botframework-directlinejs.
Hi all, sorry I've been on my other github account. A while ago I forked the repo and removed the .send(null) part and since then I haven't had any issues on any browser (on React) or any device (on React-Native). I apologize, I have not sent in an empty string (.send('')) yet to see if it works. But up until now removing the send completely has worked for me. I realize it's a cheap fix, but at the time I was in a rush.
from botframework-directlinejs.
@grootendorste Thank you for the response. Unfortunately this doesn't help us evaluate the solution on the table.
from botframework-directlinejs.
@billba Sending {} instead of null also does fix the solution. I'm not a fan of quick fixes that I can't really motivate, can anyone explain why this is a good idea?
from botframework-directlinejs.
@grootendorste we're looking to see if send("")
fixes the solution.
This is not a quick fix.
We periodically ping the server to see if the connection is still good. We can't send just any message, but
our server specifically ignores null
and ""
as messages, so those are safe as pings. We had been sending null
, which works in the browser, but breaks React Native. So since none of us here use React Native, we are trying to find out if send("")
works on React Native.
from botframework-directlinejs.
@billba send("")
does indeed work. Confirming on React Native 0.50.
from botframework-directlinejs.
Hooray, thank you @colewinans!
from botframework-directlinejs.
Related Issues (20)
- Conversation Start Properties not being passed to the PVA Bot HOT 6
- DirectLine NodeJs - Duplicate Activity from bot HOT 2
- Restart Conversation After 24 Hours HOT 2
- subscribe not working when using react-query HOT 1
- subscribe not working when using react-query HOT 4
- This repo is missing important files
- Automated Tests With BotFramework-DirectLineJS HOT 6
- Whether to support the wechat mini program HOT 1
- Hello, how to send by directline, the ID of my QA environment? HOT 2
- Please create an Offline DirectLine Emulation that is supported by Microsoft.
- DirectlineStreaming doesn't work with Node.js HOT 7
- Error with Power Virtual Agent: Site Missing code 403 from https://directline.botframework.com/v3/directline/conversations HOT 1
- DirectlineStreaming - Retrying connection after end HOT 5
- Update webpack target for modern Node HOT 1
- DirectLineStreaming: unhandled rejection from connectWithRetryAsync in activity$
- While sending attachment, activity API was not triggering using botframework-directlinejs HOT 2
- Post an activity with attachment occurs 502 HOT 3
- Attachements limitation and expiry on DirectLine HOT 1
- DirectlineStreaming: Errors on disconnect are written to console HOT 2
- networkInformation: Switching network type, then switching back again, results in RECONNECT_REJECTED HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from botframework-directlinejs.