JSON Proxy
Experimental Feature
This is an experimental feature and still in development. If you have questions, ask the Rollbar team.
Some SDKs include interfaces to enable integration between SDKs or integration with other software. These capabilities include:
- Capture JSON payloads before send.
- Transmit a JSON payload as is.
All Rollbar SDKs send the same JSON format and schema to the Rollbar API. Therefore, payloads generated by one SDK should be able to be sent by another SDK, or sent by the same SDK later, or sent by any other system that can POST to the Rollbar API. This enables proxy scenarios, delayed send, and other customizations. Because the payload is already ready to POST, proxy layers need to know nothing internal to the SDK.
Currently the Rollbar SDKs have partial support for these interfaces, as listed below.
sendJsonPayload
Accepts a complete and fully formed, serialized JSON payload and transmits it according to the SDK’s current settings. (Current API endpoint, current rate limits, etc.) All parts of the originating payload remain intact, including notifier metadata, language environment, timestamps, etc. This allows the following SDKs to function as a transport layer only.
Server JS: Rollbar.sendJsonPayload(jsonPayload)
iOS: (void)sendJsonPayload:(NSData*)payload
Android: public void sendJsonPayload(String json)
RollbarProxy (Browser JS only)
Intercepts JSON payloads before they are sent. If RollbarProxy
is detected, all browser JS occurrences will be sent to RollbarProxy.sendJsonPayload()
instead of the configured network transport. The implementation of RollbarProxy
assumes responsibility for transport.
Browser JS: RollbarProxy.sendJsonPayload(json, function success(msg), function error(err))
Example:
var RollbarProxy = function() {};
RollbarProxy.prototype.sendJsonPayload = function(json, success, error) {
// Queue, store, or forward json payload
// Callback either error or success
// success(msg);
}
Updated 12 months ago