How does pubsub work in OpenSocial? - opensocial

I'm trying to design an application based on the OpenSocial API, and I'm uncertain of how the pubsub apparatus will work. This appears to be analogous to a Unix pipe, or perhaps an RSS feed.
Is a channel persistent across browsers / computers? That is, can I subscribe to channel "x" on browser A and publish to "x" on browser B, and have this data be read in browser A? If not, is there a convenient opensocial method of accomplishing the same thing?
Also: if one gadget subscribes to a channel after data is published, can that data still be read?

Pubsub is an API feature that allows different OpenSocial gadgets to talk to one another while being on the same page in an OpenSocial container.
That means the connection is not persistent, but if for example you have a map gadget, and a gadget with a list of restaurants which both appear in a page, this mechanism can enable the list to stay relevant to the currently shown area of the map.
This would require the two gadgets to agree on a message format and channel ahead of time.

Related

User notification in SAPUI5 using AMC channels

Managed to get a start with APC Channels, connect from a small sample SAPUI5 app and get messages back, so far so good. Exercise now becomes more interesting, I want to do AMC, send a message to my channel for forwarding to other users who run another instance of the same SAPUI5 app and each of these users receiving only their own messages based on the SAP User ID (that can be part of the message). Been through this really good stuff below:
ABAP Channels Part 3: Collaboration Scenario Using ABAP Messaging and ABAP Push Channel
ABAP Push / Messaging Channel and SAPUI5 Demo Application
If I got things right reading these two, I can combine APC and AMC channels and consume messages I send to the AMC by using WebSocket class methods in SAPUI5. What I don't get is how I can redirect the result to another user. I was thinking that maybe this can be done by using dedicated channels per user (as written above, talking about internal application) in the AMC channel list.
a) is the above assumption right?
b) Can this be done?
c) If the above can be done, can I go even further by (I have no idea how to do that) retrieving client browser sessions for the user (in case there are more than one) and send the message only to one of them?

GAE sockets vs. Firebase

I want to develop an application where a number of clients should be able to see a list of elements. The elements in the list can be occupied by other users, so the users should be able to see when a given element is available/occupied.
The clients will fetch data via a REST API on GAE, and when they have fetched the list of elements, I imagined that I would create a socket connection for continuously updating the element list when the available/occupied status changed.
Reading the socket documentation for GAE lead me to the Channel API, which lead me to firebase https://cloud.google.com/solutions/using-firebase-real-time-events-app-engine
My question is: for an application as the above, should I use sockets (I cannot determine from the documentation whether I would be able to create sockets to clients?) or Firebase?
If I should use Firebase, how will this work seen from the client side - e.g. android/ios apps - they are supposed to use the SDK's to access the Firebase datastore?
I want the clients to contain as little logic as possible.
-Lull
With Firebase, you don't have to worry about sockets and connections if you use any of the provided client SDKs. It handles all the connection logic. You just indicate the location of the data you want to observe, and it will call your listener whenever there is a change.

What technologies should I use to create a real time One to One chat?

I'm a PHP developer with a lack of experience on other sever side langages.
I’d like you to give me leads, advice, keywords or whatever that could help me refine my research better.
What I want to do is basically to create a one to one mobile app chat that will scale.
There will be channels of 3 users: User A, User B and the "computer" pushing some messages according to some channels informations like the last time a message has been sent, etc.
User A should know if User B is online, writing, etc.
Every conversation should be stored in a database and would be analyzed by some algorithms. Those algorithms would also analyzed stuffs on user Facebook open graph.
The application should be able to send notification on IOS and Android.
A web administration should allow admin to set some stuff that will define what kind of message would be sent by the "computer".
I'v read lot of posts about websocket, xmpp, node.js, socket.io, etc but I don't have enough knowledge in those areas to decide what architecture should I build to make everything works together. Or maybe there is some cloud base solutions that would fit my needs...
Thanks
As you've stated there are many ways to implement that kind of structure but I am going to write about node.js + socket.io part;
1) It is scalable. You can use cluster, nginx, haproxy. etc. to apply load balancing to your socket.io application (see here) Of course you've to use redis or mongo or some kind of store for socket.io that different servers and processes can communicate each other. (see here)
2) socket.io have rooms. That means clients and any computer bots can join that room to share events with each other. So, in your scenario User A, User B and a computer bot should join to same room and events sent to that room will be broadcasted to every room member. (events can vary as online, typing, new message, anything) (see here)
3) node.js can send push notifications both for iOS and Android.
4) You can write every message to database of your choice on new message event.
5) You can create a REST api with Express framework for your Administration page. And you can use passport for authentication and authorization purposes. You can consume the rest api with Jquery or some other frontend framework like React etc.
Meteor is very well suited for something like this and gives you everything you need. There are also open sourced chat systems built with meteor already to get an idea of where you need to go. The more custom route would be to do what #cdagli said.

Filter/Prevent client publishing behavior to rooms in Faye

I was looking at using Faye for a project I've been working on since socket.io has been causing me trouble. I set up and played with some of the examples on their github and found that clients can publish straight to whatever room they are connected to. This is different behavior than what I would like. I want to limit client behavior in certain rooms to where they cannot publish at all but the server will periodically send data to the room updating them all on new information (Basically a strict subscribe behavior on certain rooms). Is this type of behavior possible with Faye or am I barking up the wrong tree?
With CometD, you can fine tune the behaviour you want.
You have available a SecurityPolicy that allow you to control coarsely the publish authorizations, and channel Authorizers that allow you to control finely the publish authorizations (among others).
Have a read at the SecurityPolicy documentation, and at the Authorizers documentation.
The Bayeux protocol has been designed by the CometD project where you can find the latest specification.
Have also a look at the CometD tutorials, if you want to get started with CometD.

Potential other uses of a jabber server

Beside the obvious person to person instant message chat, What else have you used a Jabber server's functionality to enable?
Edit: links to working code to really show it off are particularly useful - and will be more likely to be voted up.
There are unlimited uses for XMPP/Jabber.
Take any message/data you want to send somewhere else and you can use jabber. Run a centralised logging service for distributed services? You can jabber the massage.
You want to check if your services/programs are running? XMPP presence will tell you. If you add custom status messages you can see exactly what is going on.
This is why Cisco has got into the game. Picture a server farm where each blade has a built in mini jabber client. On boot up it will register it's presence to the central server as awaiting work. The central server fires off some work in it's direction and it then changes it's status to "Busy". Another blade finished it's work and changes it's status back to "Available"... rinse and repeat.
When you combine the actual jabber messages with it's Out Of Band abilities, these servers can post where the results of the job can be found.
Anything you can think of needing to pass a message can be done with XMPP to some degree. Be this person to person, program to program, or any combination.
You could use a Jabber server to handle/broker messages between a client application and another server application.
It can actually be pretty effective.
Not me but Martin Woodward used jabber to control a "build bunny" that displays the current status of the build server.
http://www.woodwardweb.com/gadgets/000434.html
XMPP is good for sending messages back and forth between computers that don't need to be broken into chunks. They also can't be terribly big. If you use the right library, it can be pretty easy to set up.
Sending messages to a web page. Proof-of-concept: esagila.com
I plan to use it to receive notifications from my system, such as:
Process did not finish
Report was not generated on time
User needs help
I already receive many of these messages as email. But receiving an IM could be much more effective.
You might want to look at Vertebra which is...
a framework for orchestrating complex processes in a Cloud. It is designed with an emphasis on security, fault tolerance, and portability.
From the knowledge base:
Why was XMPP chosen for Vertebra?
XMPP based instant messaging can be a good alternative to search engines for information that is small, complete in itself and required frequently and repeatedly. For example, your daily horoscope - you require it daily and it is not large.
To see an example of this add astro#askme.im to your list of contacts in your jabber client (Gmail Chat/Gtalk/or any other Jabber client) and then initiate chat with this contact by sending the word "help".
Also see www.askme.im for a whole list of chat based solutions.
I've used Jabber in the past to get email notifications. Nowadays I use it for low-priority nagios notifications, it is very useful and way cheaper than SMS:
We use xmpp as both a 'bus' and a real-time API at http://superfeedr.com
Iowa State University Department of Agronomy has created this with Jabber: http://mesonet.agron.iastate.edu/iembot/
If you're a weather freak like I am, this is VERY cool stuff!
Apple implements mobileme's push service using Jabber/XMPP's subscription services to send push notifications. That is the most widespread use of Jabber for non-IM purposes I know of. This article has more details.
My friends have also built a Jabber python bot, which is kinda cute but not all that useful :-)
Edit
The most recent Next Big Thing, Google Wave, uses Jabber under the hood. Further illustrates the power of the protcol.
We have used XMPP and BOSH to enable users to communicate with a webbrowser directly and in realtime from their phone.
For example Code you can view our open source API
The vooices site also has live examples where you can control a map and play a game using your phone via your web browser: http://www.vooices.us/
I've always thought XMPP would be a good way to deliver SNMP data. OIDs are really painful, much of the system is insecure, and the SNMP traps never work quite like you want them to. With an XMPP server in the middle and a smart component to make some choices, you can use it to send out jabber or other notifications, kick off restart jobs, update web pages, or whatever else you need.
The XML data is pretty small in this case, and you can have the one XMPP server both talk to humans in message stanzas, or computers with the same protocol.