Created
January 14, 2015 07:21
-
-
Save mlabbe/9e24ab3ec9eca4eaca1d to your computer and use it in GitHub Desktop.
Claypot Client Posting to HTTP Queue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void OnClaypotHTTPResponse( const HTTP &http, void *datum ) | |
| { | |
| HTTPError httpError; | |
| Message("HTTP Queue callback. Response Code: %i: %s\n", | |
| httpError.GetStatusCode(), httpError.GetStatusString() ); | |
| } | |
| void PostClaypotEvent( const char *eventName, | |
| const Dict &eventKeys, | |
| unsigned long tsOffset, | |
| URL &claypotServer, | |
| const char *ipSalt, | |
| HTTPQueue &hq ) | |
| { | |
| ClaypotEvent event; | |
| event.Set( eventname, eventKeys, tsOffset ); | |
| // Use the single-event posting interface | |
| size_t requestBytes; | |
| const char *resource = event.GetURLResource(); | |
| const char *requestBody = event.GetHTTPRequestBody(&requestBytes, ipSalt); | |
| claypotServer.SetResource( resource ); | |
| HTTP::Request request; | |
| request.Set( requestBody, requestBytes ); | |
| request.AddHeader( "User-Agent", "Frogtoss Claypot Client" ); | |
| hq.AddPostRequest(request, OnClaypotHTTPResponse); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment