Whenever DisconnectedEventHandler is triggered, the args.Conn.ConnectedUrl is Empty in NATS.IO C# API - nats.io

I am building a messaging application using NATS C# API. I have set all event handlers, but I have a problem in DisconnectedEventHandler. In the Github page, they have shown how to handle the event. I did exactly the same but whenever DisconnectedEventHandler is triggered, args.Conn.ConnectedUrl shows nothing. I just want to know which server is disconnected. Can anybody please help me on this?
Thanks in advance.
Cheers
J

If you are disconnected, but definition you are not connected to any server, so it makes sense that ConnectedUrl() returns nothing. You could save the URL you are connected to on success and then use that when getting disconnected.

Related

Application Insights removing telemetry after it has been logged

I've had Application Insights set up on my ASP.NET project for a couple months with no issues. I use Custom Events for logging certain events.
Recently, I tried to add a Custom Event after a user has authenticated in order to track the login behavior. My custom event DOES log to application insights debug session. I know this because I can see it in the telemetry when paused on a breakpoint just after the event.
However, when I continue running the application, my custom event no longer shows up the telemetry. It just disappears.
I cannot understand what the issue is. Does anyone familiar have any (application) insights? I couldn't help myself ;)
There are some things to check:
are you logging to one resource (iKey) and searching on another? (a lot of people send data to one resource in dev/debug and a different resource in release/prod environments. so make sure you're sending to the place you expect, and searching the place you expect.
is the data actually going out successfully? you may need to use fiddler or some other tool to watch your outbound http for calls to dc.services.visualstudio.com. It could somehow be the case that there's something wrong with the data you're sending, or maybe you're getting capped or throttled by the service. If that's the case, the outbound requests will have responses other than 200, and will generally tell you the reason it didn't accept any items that it rejected.
if the data is getting successfully sent and is going where you expect it to go, there might just be a delay in backend processing. you can always check aka.ms/aistatus to see if there are any current issues with the service.
I am confused, however, by what you mean when you say
However, when I continue running the application, my custom event no longer shows up the telemetry. It just disappears.
What do you mean "it just disappears" ? if you see it in the output window, then the SDK saw it, and it will get sent, precluding any of the above 3 items. Where is it "disappearing" from? unless you clear the output window, it's never gone from there. If you're talking about the VS search tools that show data sent by the AI SDK during debug, that tool currently has a cap of the most recent 250 items that have occurred during the debug session.

Not receiving AppMessage callbacks when sending message inside a bluetooth connection event

Title sums it up. Same question is here. Posting on SO to see if I can get any help. I also made an almost minimal project to demonstrate the problem I'm facing, so links that follow point to the piece of code being mentioned.
Nothing fancy on what I'm currently doing:
My watchface is notified that the bluetooth connection with the phone is up, using .pebble_app_connection_handler.
In that bluetooth callback I set up, I send a message to the phone using app_message_outbox_send(). When BT connection is up, of course.
My Android app has a BroadcastReceiver that listens to these messages and calls an IntentService.
This IntentService calculates the data, pushes it to the watch and sets itself to run again after some time.
What I expect:
When the BT connection is up, the connection handler to be called.
app_message_outbox_send() return a value telling if the message initiation had any errors. Normally, this is APP_MSG_OK, but it can be APP_MSG_BUSY, and I'm perfectly aware of that.
The app message callbacks (app_message_register_inbox_received and friends) be called to indicate if the asynchronous process of sending message to phone really worked. This is stated in the docs.
What I'm seeing:
The expected steps happen when the watchface is loaded, because I trigger the update manually. However, when the update is triggered by a BT connection event, expected steps 1 and 2 happen, but not the step 3.
This is particularly aggravating when I get APP_MSG_OK in step 2, because I should reasonably expect that everything on the watch went OK, and I should prepare myself to receive something inside the app message callbacks. Basically, I'm told by the docs to wait for a call that never arrives.
This happens 100% of the time.
Thank you for any help. I have another solution that works, using the watch to keep track of the update interval, but I believe this one allows me to save more battery by making use of recent Android features.
From documentation :
To also be notified of connection events relating to any PebbleKit
companion apps associated with this watchapp, also assign a handler to
the pebblekit_connection_handler field. This will be called when the
status of the connection to the PebbleKit app changes.
Maybe it is what you need

How to determine current PBX status (calls, ringing, etc. etc.) with asterisk-dotnet

I am using asterisk-dotnet, and I am looking for a way to get the current PBX "status".
What I need is to determine:
which extensions are busy in a call
which extensions are ringing
which number is calling the extension
which number is called by the extension
and the extension number itself.
I know that I can obtain part of these data by using the Status Action, the ExtensionState Action and the NewChannel Action. However these work when an event happens. For example, if an extension is busy on a call, I'll have a new ExtensionState only when the call ends (when the channels are dropped and the peer is available again).
Any help will be much appreciated.
Thanks in advance,
Gianluca
I've just checked Asterisk changelog. It appears that a CoreShowChannel action has been introduced in Asterisk 1.6. I still have to do my homeworks, but I guess that's all I need to get info about what's going on the server at my app startup time.
After this initialization, event tracking is easier as there are already many events that one can subscribe to in order to be notified about new calls, hangs up, etc.
Hope this can help someone else.
Cheers,
Gianluca.

Event dispatched when network is disconnected while downloading files (URLs) for URLStream object

I am creating an AIR application which downloads file from a server. I am using URLstream object with complete, progress, IOError, security error and HTTP status events. I am not getting an event if the network is disconnected when the download is in progress. Please can anyone tell me which event is dispatched?
Thanks,
Anahas
You should get the IOError event in case the network gets disconnected. If you're not getting it, you either didn't add a listener for that event, or you added it on the wrong object, or there's a framework/Flash bug.
There is also a separate set of events that AIR uses to communicate connectivity status. They can monitor services, servers or just "connectivity" ( do I have network ). Monitoring network connectivity
I agree with bug-a-lot though, at some point you should get an IOError but you might have to wait for a timeout to occur.
is there way to change the time-out for IOError while loading using urlstream ?
sometimes even though network is disconnected i dont get the event but its not very definitive.

What would make a callback request hang?

I am working on a project that uses the asp.net ajax control toolkit and all my callback requests are hanging till the request times out. When I step through the code all my code executes then the hanging occures. Right now I am looking for possible reasons why this might happen.
If the request takes significant time, it is possible that the client-side AJAX request is timing out before your server-side code completes. At that point the client has dropped the connection and the server can no longer communicate with it. Can you look into increasing the timeout value on the client to something really big to eliminate this as a possibility?
Firewall or NAT? Something on the network might be blocking return calls from getting back to you.
Check if the callback address you are providing is valid to the server. For instance, the server may not be able to translate some host name or DNS entry.

Resources