:::: MENU ::::

Getting to Know Respoke: Endpoints

One thing I found to be a bit confusing when I first started using Respoke was the concept of Endpoints, or to be more specific: how endpoints function within the Respoke platform. First let’s start with defining what an Endpoint is. At its most basic level, an Endpoint represents a user within the Respoke system. That being said, a “user” could be any number of things: a person connecting from their browser or mobile device, a server, a SIP phone, or even a Robot Chicken (if we could just get the good Doctor to add WebRTC support!). Basically anything with the ability to establish a connection with the Respoke framework can become an Endpoint.

Robot Chicken

So now that we know what an Endpoint is, the next thing to figure out is how to communicate with them. When connecting a user of your application with Respoke, it will be up to you to supply an Endpoint Identifier that will be used to identify the Endpoint through which that user can be reached. The Endpoint Identifier is essentially the ID of the user within the Respoke framework, and can be anything you want: an email address, a generic user id, or whatever other method you might use to track your users.

One thing to keep in mind is that a user might connect to Respoke multiple times with the same Endpoint Identifier, but not to worry, Respoke automatically maps all of these Connections to a single Endpoint. The advantage of this is that you don’t have to worry about tracking all the locations where your users are connected. Respoke will take care of sending any messages or calls to all of the Connections for an Endpoint. In the example below, Joe sends a message to Endpoint with ID foo@bar.com. Joe only sends the message once, but it will be distributed out to all the places where foo@bar.com is connected to Respoke (in this case a laptop, cell phone, and toaster!).

image

One last tip: You can get a reference to an Endpoint regardless of whether or not the “user” whom that Endpoint represents is currently connected to Respoke. I know this may seem a bit confusing at first, but stay with me! Imagine you’ve built an application that allows users to send messages to one another. You have a database full of users that are signed up for your app, and you want to be able to get notifications for when a user comes online. When the app launches, it pulls down the information about your users, and creates an Endpoint for each one. Now, not everyone is going to be signed into the app, but you can still create an Endpoint for them as follows:

So now that we have an Endpoint for user “foo@bar.com”, we can call methods like Endpoint.getPresence() to find out if they are currently online or not. The really cool part of this is if the user is not online, we can still create an endpoint for them, and when they do come online, Respoke will automatically connect them to the Endpoint instance that we have already created!

So that’s a brief introduction to Endpoints in Respoke. If you still have any questions, feel free to leave me a comment below, or head over to the Respoke Community Forums and post your question there. You can also find more information about Respoke Endpoints in the Respoke Docs.



So, what do you think ?