Skip to content
This repository has been archived by the owner on Aug 6, 2021. It is now read-only.

Latest commit

 

History

History
37 lines (24 loc) · 721 Bytes

socket.request.md

File metadata and controls

37 lines (24 loc) · 721 Bytes

io.socket.request()

Sends a virtual request to a Sails server using Socket.io.

This function is very similar to io.socket.get(), io.socket.post(), etc. except that it provides lower-level access to the request headers, parameters, method, and URL of the request.

This function is provided by the sails.io.js JavaScript client, and is accessible in the browser.

Usage

io.socket.request(options, function (data, jwr)){
  // ...
  // jwr.headers
  // jwr.statusCode
  // jwr.body === data
  // ...
});

Example

io.socket.request({
  method: 'get',
  url: '/user/3/friends',
  params: {},
  headers: {}
})