question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Disconnect/close/cancel from the client side

See original GitHub issue

Hi, I can’t find any method to disconnect the client as per my command. Using an example snippet here -

function doSomething () {
    var SomeServiceClient = xxx.yyy_service.SomeServiceClient;
    var client = new SomeServiceClient('http://localhost:8080', null, null);
    status = client.testme(parameters, {},function (err, response) {
        console.log('testme response: ' + response);
    });
    // how do i disconnect the client?
}

The problem I’m encountering is - user clicks a button, I make a request to the gRPC server and start receiving data in a stream. If the user clicks again, I start receiving data again in another stream. I want to disconnect any previous streams/connections so that I can receive only one stream at a time. Any help/suggestions would be greatly appreciated! (I know I could disable the click till the stream is finished, but that’s not what I’m looking for.)

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5

github_iconTop GitHub Comments

6reactions
longfellowonecommented, Apr 6, 2019

How do you cancel a request when using the promise client? as the client.request only returns a promise?

4reactions
stanley-cheungcommented, Dec 7, 2018

In your snippet above, you can call status.cancel().

Read more comments on GitHub >

github_iconTop Results From Across the Web

how to know at server side on disabling connection on client ...
hi, i developed a video conferencing tool. In this tool at server side i maintain the incoming clients as a thread.
Read more >
CWE-603: Use of Client-Side Authentication
A client/server product performs authentication within client code but not in server code, allowing server-side authentication to be bypassed via a modified ...
Read more >
Client-side encryption, developer productivity, & more!
Here to bring you the latest news in the Cloud is Kelci Mensah. • Meet Climate Insights → https://goo.gle/3I9WSw0• Improve Developer ...
Read more >
Client-side coding: How to prevent malicious use?
Any attempt to protect secure resources client-side is doomed because it violates several of the immutable laws of security. #2/3 - if your...
Read more >
Client side vs Server side: Everything you need to know - Lytics
Understanding client-side and server-side scripting is essential to build your website for customers' needs. Learn everything you need to ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found