Is there a way to detect when the user on the other end of a SINCall crashes? There seems to be no change in state on SINCall.details.endState or SINCall.state.
I'm currently using a hack to listen for a specific message in
client(client: SINClient!, logMessage message: String!, area: String!, severity: SINLogSeverity, timestamp: NSDate!)
to accomplish this.
You are right, currently there is no callback triggered when the SINCall crashes on the other end.
Related
What is pbm_commnotify event in PowerBuilder? How can it be triggered?
global type some_type from Window
...
event commnotify pbm_commnotify
...
end type
on commnotify;
...
end on;
I am working for a project that requires us to convert a system written in Powerbuilder many years ago into a web application. I am new to Powerbuilder and really have no idea how this type of event can be triggered.
Most pbm_xxx event IDs in PowerScript map to wm_Xxx in Win16/Win32.
Your example:
Code for event commnotify is the "event handler" for Win32 message WM_CommNotify.
Be aware:
Some PowerScript event IDs don't map to Win16/Win32 messages.
You may encounter unmapped PowerScript events (events without event IDs).
pbm_custom01, pbm_custom02, ... map to WM_User, (WM_User + 1), ...*
I've called an action creator from a component to create/edit a resource, which in turn sends an API request to a server. How should I handle cases where the server is down, or returns an error? I want any relevant components to be notified of the success/failure.
My current ideas are to:
Dispatch COMMENT_FAILED, COMMENT_SUCCESS actions to the comment store, which then notifies the components somehow?
Use promises within the initiating component to catch errors from the action call and respond/render them appropriately.
Which is better? Why?
This has been previously asked in React+Flux: Notify View/Component that action has failed?, but the only proposed solution is to use Promises as in 2. I can certainly do that, but it seems... un-Flux-like.
What I usually do is create an error reducer specific to my container/component. For instance, if the user filed a login I would dispatch the error to my login reducer as follows.
export default function dispatchError() {
return function(dispatch) {
dispatch({
type: 'LOGIN_ERROR',
payload: 'You entered an incorrect password'
});
}
}
Now in your instance this would be very similar. Anytime there is a failed request dispatch to your reducer.
I am making an addon in Firefox, so I have a ChromeWorker - which is a privileged WebWorker. This is just a thread other then the mainthread.
In here I have no code but this (modified to make it look like not js-ctypes [which is the language for addons])
On startup I run this code, conn is a global variable:
conn = xcb_connect(null, null);
Then I run this in a 200ms interval:
evt = xcb_poll_for_event(conn);
console.log('evt:', evt);
if (!evt.isNull()) {
console.log('good got an event!!');
ostypes.API('free')(evt);
}
However evt is always null, I am never getting any events. My goal is to get all events on the system.
Anyone know what can cause something so simple to not work?
I have tried
xcb_change_window_attributes (conn, screens.data->root, XCB_CW_EVENT_MASK, values);
But this didn't fix it :(
The only way I can get it to work is by doing xcb_create_window xcb_map_window but then I get ONLY the events that happen in this created window.
You don't just magically get all events by opening a connection. There's only very few messages any client will receive, such as client messages, most others will only be sent to a client if it explicitly registered itself to receive them.
And yes, that means you have to register them on each and every window, which involves both crawling the tree and listening for windows being created, mapped, unmapped and destroyed and registering on them as well.
However, I would reconsider whether
My goal is to get all events on the system.
isn't an A-B problem. Why do you "need" all events? What do you actually want to do?
Starting up a WinEventHook doesn't seem to be working reliably.
What would cause an event hook to only monitor events (or run the identified event proc function) sometimes?
ie. inside an IE8 BHO
HWINEVENTHOOK eHook = ::SetWinEventHook(EVENT_OBJECT_SHOW, EVENT_OBJECT_REORDER
, 0
, MSAALib_WinEventProc
, GetCurrentProcessId(), GetCurrentThreadId()
, WINEVENT_OUTOFCONTEXT );
I've been getting events quite regularly, but after a recent build it doesn't work except when I'm also running MS "Accessible event watcher", stopping and starting the event watcher also stops and starts my event proc being called.
I haven't changed the SetWinEventHook in any recent build so I do not believe this is the cause.
All the other thread/message pumping actions are taking place as expected so I do not believe failure to pump messages on the thread is the cause.
Testing getting reorder events using http://www.quirksmode.org/dom/events/tests/DOMtree.html and adding/removing test elements.
Edit:
Upon further testing it appears the change may have been that I stopped running the "Accessible event watcher" and not the build.
The range of events captured by the event hook without the "Accessible event watcher" appears to be [first, last) or eventMin to eventMax-1 which is not as per the doc SetWinEventHook when starting the "Accessible event watcher" the range changes and appears to be [first,last] so using an eventMax of EVENT_OBJECT_FOCUS seems to get the desired result of seeing EVENT_OBJECT_REORDER.
Is there something I'm missing here, or is the doc just wrong and the event watcher is doing something aswell?
I'm new to XMPP and the xmpp4r library, so please forgive my noob question if this is obviously documented somewhere.
What's the most straightforward way, in a synchronous manner, to find out if a given JID is online? (so that I can call something like is_online?(jid) in an if statement)
My details:
I'm writing a Sinatra app that will attempt to send a message to a user when a particular url gets requested on the web server, but it should only try to send the message to the user if that user is currently online. Figuring out if a given JID is online is my problem.
Now, I know that if I connect and wait a few seconds for all the initial presence probe responses to come back to the Roster helper, then I can inspect any of those presences from my Roster and call #online? on them to get the correct value. But, I don't know when all of the presence updates have been sent, so there's a race condition there and sometimes calling #online? on a presence from my roster will return false if I just haven't received that presence probe response yet.
So, my current thinking is that the most straightforward way to find out if someone is online is to construct a new Presence message of type :probe and send that out to the JID that I'm interested in. Here's how I'm doing it right now:
#jabber is the result of Client::new
#email is the jid I'm interested in polling
def is_online?(jabber, email)
online = false
p = Presence.new
p.set_to(email)
p.set_from(jabber.jid)
p.set_type(:probe)
pres = jabber.send(p) do |returned_presence|
online = returned_presence.nil?
end
return online
end
Now, this works in cases where the user is actually online, but when the user is offline, it looks like the presence probe message that comes back is being caught by some other presence_callback handler that doesn't know what to do with it, and my is_online? function never finishes returning a value.
Can anyone help me by providing a simple example is_online? function that I can call, or point me in the right direction for how I can detect when the roster is done getting all the initial presence updates before I try checking a presence for #online?
As it turns out, there's not a synchronous way to ask for a JID presence. You've just got to ask for what you want, then wait for your response handler to fire when the response arrives.