Google Wave Robot - Change to Wave in response to an external event - google-wave

I am writing a Google Wave Robot that allows users to "manage a wave". I plan to have a configuration page on my website. When the configuration is changed, ideally all waves where this user added by this user should change immediately (or at least next time someone views the wave). What is the best way of doing this?
Apparently, "a robot cannot contact Wave directly; it can only respond to wave-related events and cron events". If I decide to go the cron route, how quickly can I update the Wave?

Please check out the new Robot API v2 - it enables robots to actively push information into Wave.

as far as I know, cron does not work at the moment (2009-11-28) either. You could add a gadget, that changes its internal state - for example 1 sec after wave loaded using a timer - and listen for DOCUMENT_CHANGED or BLIP_SUBMITTED (less volume) events. But unless your bot comes with a gadget anyway, this is of course not very pretty.
=HC

Related

User 1 (with camera) does not transfer to User 2 (without camera), if the camera is turned on for both - everything is OK

Stack: Nextjs, expressjs, socket.io, WebRTC
I'm trying to build a video chat, at the moment everything works fine only if the second user joins and agrees to use the camera and has one at all.
Otherwise, the connection is established, a chat is available between two users, but user 2 does not receive the video stream of user 1.
I put this code on github for more clarity and a better understanding of what is happening.
Very big cosmic thanks for help!
You are calling createOffer without the "legacy" offerToReceive* constraints. Without these, if the user creating the offer does not have a camera they will only negotiate audio and not attempt to negotiate video.
See https://webrtc.github.io/samples/src/content/peerconnection/pc1/ for a sample using those options.

Queue publish calls with PubNub when offline

I'm dabbling with using PubNub for various parts of my app. I'm using their AngularJS library for this.
Right now, I'm just testing it for doing "analytics". Basically, I want to track ever more a user makes in the app - buttons pressed, states navigated to, etc. So, I track actions and publish on a channel.
It all works great - when the user is online. However, when offline, I lose all this tracking. I was sort of hoping that PubNub client would automatically queue all the publish requests. It does not seem to do this.
So, I'm thinking I'll have a service to collect all publish requests and put them in a queue if the device is offline. Once the device is back online, I'll publish any queued requests.
Is this the best approach? Does anyone have a better suggestion? Does PubNub already have this ability and I'm just not finding it?
Yes, currently, this is the best way to achieve this.
There are different scenarios for queuing / retrying, for example -- depending on the content of the message (eg expiration/timeliness of the message), and depending on the reason (no internet, channel permissions) you may want to re-queue/retry some and not others, etc.
So if you can implement your own retry logic custom to your use case, thats ideal. We may provide more productized options on this moving forward...
geremy

Best approach for real time process information / Server + JS Client

I have a C# Web API project on server side and on front-end I have ExtJS 4.2.1 (Javascript framework client).
There is a section in my app where I request to start a long running process (about 5 minutes) and I want to show the user the status of the process being executed.
Basically, the process will run a special calculation for every employee in the database (about 800), so I want to let the user know which Employee is being processed in that moment.
So I was thinking in two ways of doing this, and maybe I don't know if having both is ok.
Use SignalR to show the information of the process in Real Time.
Write to a database table all the process log (every employee that its being processed).
If I use the first approach, if the user close the browser he will loose all the information about the process and if he log into the app again he will only see the actual status.
If I use the second approach, if he log into the app again he could see all the information, and using maybe a timer on client side the data could be refreshed every 5 seconds.
Does anyone have implemented something like this? Any advice is appreciated.
You should use a combination of the two. When you have calculated a employee save the state to the database and publish the change on a service bus.
Let SignalR pick these messages up and forward them to the client. This way the user will see old state when he connects and new state then they arrive with SignalR. I have created a Event aggregator proxy that makes this very easy.
https://github.com/AndersMalmgren/SignalR.EventAggregatorProxy/wiki
Follow the wiki to set it up, here is a demo project
https://github.com/AndersMalmgren/SignalR.EventAggregatorProxy/tree/master/SignalR.EventAggregatorProxy.Demo.MVC4
Live demo
http://malmgrens.org/Signalr/

refresh rate for insert/update for subscriptions? rate,quantity, etc

I have questions related pushing messages to a user.
Here is the use-case.
A user is walking inside a wifi enabled warehouse and we would like to use the glasses to send critical information and warnings about the components in that building which required the user to interact with the component(s).
We have used push notifications in android devices with ok results, but with a live hud I would like faster updates.
Basically we will send something like this to the user
{
"html": "<article>\n <section>\n <strong class=\"red\">ALERT </strong>13:10 device ABCD tolerance failure. \n </p>\n </section>\n</article>\n",
"notification": {
"level": "DEFAULT"
}
}
How quickly can we get the information to the device?
What is the update rate? If we see an alert from a machine can, how quickly can we refresh the user of its status.
Is there some type of flood protection that would cause us grief?
I assume native api will have more options, such as polling or some type of custom subscription service which we could use for faster updates than google's service. Is this correct?
Thanks
Nick
This is not something that is expected to be done with the Mirror API. The GDK is where you would want to do this and they are taking feature requests. You might want to add your use case to this thread:
https://code.google.com/p/google-glass-api/issues/detail?can=2&start=0&num=100&q=&colspec=ID%20Type%20Status%20Priority%20Owner%20Component%20Summary&groupby=&sort=&id=75
To answer some of your other questions:
1 - Mirror API card pushes happen within seconds
2 - Seconds
3 - You are currently limited to 1000 card pushes a day per developer account, so that would be shared across all your users
4 - Curently there is no supported way to do that
As a final thought, if you really want to do this without official support, you could watch this video which shows you how to run "normal" android apk's on Glass. It is a presentation from Google I/O 2013:
http://www.youtube.com/watch?v=OPethpwuYEk

How to implement timer callback on Google App Engine

Consider implementing poker on Google App Engine. Suppose a player is allowed only 10 seconds to check/fold/raise.
That is, if 10 seconds pass with no response from the player then some timer should fire which executes code that writes to DataStore declaring that the player folded. What is the idiomatic way to implement this on Google App Engine.
The GAE has a feature called "Tasks". Sadly, they have no guaranteed resolution, so a task scheduled for now+10 seconds can execute in 10 seconds or any later time.
Solution: Write the current time-stamp along with the information about the current player into the database. If any of the players request updated information about the current game, you can check this time-stamp, compare it with the current one, and therefore determine if these 10 seconds have passed and update the database accordingly.
You can combine this solution with tasks to ensure, that even if nobody "watches" that game, its still updated sometime.
This needs to be done on a backend, as that's the only code that can persist outside of a request handler.
Player is dealt. Timer starts on backend. Timer expires. Player
status updated.
Backends are special App Engine instances that have no request deadlines, higher memory and CPU limits, and persistent state across requests. They are started automatically by App Engine and can run continously for long periods. Each backend instance has a unique URL to use for requests, and you can load-balance requests across multiple instances.
https://developers.google.com/appengine/docs/python/backends/
No need to act synchronously - i.e. do some action exactly 10 seconds after last user action.
Just record the time of last user action and act accordingly next time the user action happens: if <10s let user do next move, if >10s notify user he folded.
To keep things more responsive, e.g. to show user how much time he hes before folding, you should also track this on client.

Resources