On Oct 23, 2013, at 5:08 PM, Paul Belanger <paul.belanger at polybeacon.com> wrote: > On Wed, Oct 23, 2013 at 5:27 PM, Naftoli Gugenheim <naftoligug at gmail.com> wrote: >> Hello. I am very excited about Asterisk 12 and ARI. >> >> I noticed on the wiki that while most of the API endpoints (used to talk >> *to* asterisk) are true REST, using HTTP, the events endpoint would actually >> use websockets, not HTTP. Many people don't realize it, but although >> websockets is often associated with "server push," HTML5 introduces another >> way to do server push efficiently, that works over HTTP, namely >> SSE/EventSource. (See e.g. >> http://www.html5rocks.com/en/tutorials/eventsource/basics/.) Although the >> basic idea is nothing new; for instance CouchDB lets you watch events >> streamed over HTTP >> (http://guide.couchdb.org/draft/notifications.html#continuous). Websockets >> are a much more powerful protocol, allowing for 2-way communication inline. >> >> In some scenarios it may require more setup for application developers to >> access websockets. For instance some platforms don't have the capability >> built in and require adding a third-party dependency. >> I would therefore like to request that you expose an HTTP endpoint that >> streams events in a connection that can be kept open, preferably using the >> SSE format. We?ve always thought that we would eventually have to add a long-polling alternative to the WebSocket interface. Server-sent events looks interesting in that regard. But this would be something that could be added on later, in addition to the WebSocket interface. >> Another argument that can be made, is that REST and websockets are two >> different protocols. Instead of implementing the API half in one protocol >> and half in another, why not have a complete REST API, *and* a complete >> websockets API? After all, websockets are 2-way, so why not let websocket >> users send commands to asterisk through it as well? >> > Well, if I understand properly, now that the stasis bus is there, > adding different interfaces shouldn't be to difficult. That?s the idea :-) > However, I'm > not sure I'd want to see Asterisk try and implement every possible way > to do this. In general, I agree. But since the design is modular, new mechanisms for distributing Stasis events could be added in their own modules, without any changes to the existing code. Given that, I?m less worried about adding new adapters to live alongside the WebSocket connection. -- David M. Lee Digium, Inc. | Software Developer 445 Jan Davis Drive NW - Huntsville, AL 35806 - USA Check us out at: www.digium.com & www.asterisk.org