View our GitHub

Please visit sails-docs on GitHub to view documentation on your mobile device.

Edit Page

Socket Client (

This section of the docs is about the Sails socket client SDK for the browser. It is written in JavaScript and is also usable on the server.

There are also a handful of community projects implementing Sails/ clients for native iOS, Android, and Windows Phone.


The Sails socket client ( is a tiny browser library that is bundled by default in new Sails apps. It is a lightweight wrapper that sits on top of the Socket.IO client whose purpose is to make sending and receiving messages from your Sails backend as simple as possible.

The main responsibility of is to provide a familiar ajax-like interface for communicating with your Sails app using WebSockets/ That basically means providing .get(), .post(), .put(), and .delete() methods that let you take advantage of realtime features while still reusing the same backend routes you're using for the rest of your app. In other words, running'/user') in your browser will be routed within your Sails app exactly the same as an HTTP POST request to the same route.

Can I use this with...

Yes. The Sails socket client can be used to great effect with any front-end framework-- no matter whether it's angular, backbone, ember, knockout, etc.

Do I have to use this?

No. The Sails socket client is extremely helpful when building realtime/chat features in a browser-based UI, but like the rest of the assets/ directory, it is probably not particularly useful if you are building a native Android app, or an API with no user interface.

Fortunately, like every other boilerplate file and folder in Sails, the socket client is completely optional. To remove it, just delete assets/js/dependencies/

Is something missing?

If you notice something we've missed or could be improved on, please follow this link and submit a pull request to the sails-docs repo. Once we merge it, the changes will be reflected on the website the next time it is deployed.


We wrote a book!

Get early access to the book
with promotion code: mcneildoc

Get the Book