PubNub, its really awesome for real-time communication. as per as documention given by pubnub team, am done with subscribe and publish instance, its working fine.
Now am wondering how get a particular user already/presence with PubNub channels in Python(GAE) apps, but I didn't find a complete guide to how to implement this feature in both server and client side.
NOTE: am using here Python Google App Engine & Javascript.
PubNub presence is a way to follow up on joins/leaves in a channel, what you need is the here_now feature if I understand correctly,
Taken from the Pyton lib is (https://github.com/pubnub/pubnub-api/tree/master/python/)
here_now = pubnub.here_now({
'channel' : 'hello_world',
})
print(here_now['occupancy'])
print(here_now['uuids'])
And now you can iterate on whoever is in the channel right now,
this can't be done in the javascript though so you'd have to have perhaps another channel for each of your real channels that you can send the information from the server-side to the client side and then update something accordingly.
Related
So recently, I set up a NodeJS bot to link messages between a Discord chat and a Skype chat. Now, I'm pretty new to Javascript, and entirely new to NodeJS, so luckily for me, there's a framework already made called Spype. The discord side works by using Discord's bot API, so that side works totally fine. The Skype side, on the other hand, uses Skyweb to connect to the Skype web client. Now, that's all well and good, except that it uses actual Skype accounts to log in, and you can no longer create actual Skype accounts, only Microsoft accounts. (Those are the ones that start with "live:".) The problem is that apparently, these two account types use different login methods. Now, try as I might, I have not been able to get the REST stuff to work for the Microsoft account login. This is probably due to my lack of expertise in that area.
So either I need to get Skyweb to log in to Microsoft accounts (this is probably the easiest option, I feel like it should be easy, I just can't get it), or change the bot to use a totally different authentication system.
I really hope someone can help with this. Let me know if I left out any information.
Skyweb has been updated, the issue has been fixed.
is possible to use the AWS SNS in the client, with Javascript?? I am creating a website that has a booking form , and I would like to send an email notification as soon as the user presses the submit button, for this I thought of using the Simple Notification Service, however I 'm not finding the documentation using with the client side. Would anyone tell me if it is possible ? I've searched on google and did not get a satisfactory answer.
Yes, you can use SNS from the client, the SNS JavaScript SDK explains how you can do that.
However, as John R said that's the wrong tool for the job. You really want to be using SES to send email.
Regardless of which one you use the biggest obstacle is not the code, it is the authentication from the client side, look here to get started.
For whatever its worth, I do not think that's your best approach. Unless your users can spot milli second differences I would just do it on the server side. I do not know what server side language you are using, but any of the ones that have an AWS SDK make this trivially easy to do.
Note though that AWS does not allow you to send production emails before you are verified. I would suggest you read through the AWS documentation for SES first. They are pretty comprehensive.
The Amazon Simple Notification Service can send a notification to subscribers in several ways:
Email (but with an 'unsubscribe' footer)
SMS
Mobile push
Push to an Amazon Simple Queue Service (SQS) queue
Messages are sent to an SNS Topic. Any subscribers to the topic then receive a copy of the notification. All subscriptions to a Topic must be confirmed.
Therefore, I would not recommend using SNS as a method of sending an email to your users. Instead, use the Amazon Simple Email Service (SES), which is designed to improve deliverability for outbound email.
There is a JavaScript SDK that can connect to SES.
I am building a multiplayer turn based game, the communication between clients and server is established with Pusher. I can send events to all clients using game channels. The problem is how do I send an event to a single client? Pusher has no documentation for it, only seemingly solution is to use authenticated channels. Is it viable to authenticate a dedicated channel for every client sending events to a single client, or is there a better solution?
You touched on the best solution in your answer. You should be able to quite easily programmatically setup channels for each individual user and then just broadcast messages to them over those channels.
e.g. (this is a Ruby example but it should be clear what's happening)
user = SOME_USER_OBJECT
Pusher.trigger("card-data-#{user.id}", 'card-update', {data: {card_id: 1, status: 'used'})
or something like that. Obviously you'd then need to make sure that on the client side that the users are subscribing to the correct channels.
Obviously if you need the channels to be secure then, as you said, you can use authenticated channels - probably using private channels makes sense in your case.
If you have any more questions then you can reply here again and I'll take a look, or you can email support at support#pusher.com.
Instead of creating an individual channel you can subscribe to an individual event for each client.
PubNub Stream Filter
If you are using PubNub, you can either create a unique channel for each user and just publish the proper message to each of the channels or you can create a common channel for all of the users and use the Stream Filter feature so that each client only gets messages they want on that channel. This filtering is performed on the server side so the end user doesn't get unwanted messages that have to be ignored.
This is the simple high level steps for using Stream Filters
When you init PubNub on the client side, create a filter using the meta parameter
When you publish messages, add key/values to the meta parameter that will be used to filter messages on the PubNub Network before sending them to the subscribers (based on each individual subscriber's filter).
For full Stream Filter docs per SDK (that you mentioned via tags):
PubNub JavaScript SDK Stream Filter
PubNub Node SDK Stream Filter
PubNub Ruby SDK Stream Filter
You could also use PubNub BLOCKS to route each message to the appropriate user channel (or however you map your channels to end users) the on before publish event handler. I won't go into the details of this since it is slightly more involved but feel free to ask for additional insights as necessary. To get started, you can review the full BLOCKS docs.
On my webpage I need to check if given user is available on Cisco Jabber Client. I have both number and user name.
I am already able to send chat messages and start voice conversations, but it would be nice to check if user is online, and for example show cool icon or something.
Is there a simple way to do that in JavaScript/jQuery?
Or is it possible to check it by server side of web application (Spring/Java) and use AJAX?
The service can be accessed using the REST Api's. Below URL can provide some information on this.
https://developer.cisco.com/site/collaboration/call-control/unified-presence/overview/presence-web-service/index.gsp
Honestly, I haven't tried this.
I'm working at a community site for a friends mmo-guild, just to increase my skills and learn new techniques.
my idea is to build a message/notification/whatever push system alâ facebook style. that means if someone sends you a message, a new post in the board appears or something similar you get a little notification just like facebook uses it (you get a little red number in your userbar at the top of the page).
now i don't know what to google for. is a "push system" the right definition for this?
how could i do it?
i also looked in different questions and read about node.js and comet.
The concept of these technologies is clear to me (from other languages, like Java)
So you have (e.g. node.js) server which pushes a message (if available) to the client. how do i handle such a push on a client? i need something like a listener, do i?
Thanks for answers
You'll find this realtime web technology guide a good starting point if you have a particular back-end technology in mind e.g. search for 'php' or 'ruby' for find a hosted or self-hosted realtime technology.
how do i handle such a push on a client?
i need something like a listener, do i?
The paradigm frequently used with all this technologies is PubSub. PubSub is achieved on the client in different ways with different technologies.
The technology you use to communicate between the client and server varies between solution but the move is very much towards the best approach being WebSocket. However, the libraries used by the realtime web technology you choose will abstract away from using WebSockets directly.
I'll demonstrate how you would subscribe to data using the Pusher JavaScript library:
var pusher = new Pusher('YOUR_APP_KEY'); // connect
var channel = pusher.subscribe('my-channel');
channel.bind('my_event', function(eventData) {
// handle event data
});
Pusher use channels and it's a commonly used term, but other technologies refer to these as topics or subjects. Channels can be used to filter data or be specific to a particular topic e.g. 'my_football_team' and events are a way of filtering data further e.g. 'new_news_item', 'score_update'.
There are various techniques to do a "push" from the server to the browser. See Wikipedia.
For a guild website that is your first attempt at doing this, it will probably be easiest to just periodically poll the server with an XMLHttpRequest and update the page content if there is new data.
Once that works, you can change it into a continuous "long poll", which gets answered by the server only when there is new data, thus reducing network traffic and making the notifications more instantaneous.