Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Added the ability to include custom headers in an outgoing message #6

Merged
merged 1 commit into from

2 participants

@gdhaworth

Just overloaded the current sendMessage method with a headers dictionary parameter.

@juretta juretta merged commit e193b51 into juretta:master
@juretta
Owner

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 10 additions and 2 deletions.
  1. +2 −0  .gitignore
  2. +1 −0  CRVStompClient.h
  3. +7 −2 CRVStompClient.m
View
2  .gitignore
@@ -0,0 +1,2 @@
+.DS_Store
+._*
View
1  CRVStompClient.h
@@ -72,6 +72,7 @@ typedef enum {
- (void)connect;
- (void)sendMessage:(NSString *)theMessage toDestination:(NSString *)destination;
+- (void)sendMessage:(NSString *)theMessage toDestination:(NSString *)destination withHeaders:(NSDictionary*)headers;
- (void)subscribeToDestination:(NSString *)destination;
- (void)subscribeToDestination:(NSString *)destination withAck:(CRVStompAckMode) ackMode;
- (void)subscribeToDestination:(NSString *)destination withHeader:(NSDictionary *) header;
View
9 CRVStompClient.m
@@ -129,8 +129,13 @@ - (void)connect {
}
- (void)sendMessage:(NSString *)theMessage toDestination:(NSString *)destination {
- NSDictionary *headers = [NSDictionary dictionaryWithObjectsAndKeys: destination, @"destination", nil];
- [self sendFrame:kCommandSend withHeader:headers andBody:theMessage];
+ [self sendMessage:theMessage toDestination:destination withHeaders:[NSDictionary dictionary]];
+}
+
+- (void)sendMessage:(NSString *)theMessage toDestination:(NSString *)destination withHeaders:(NSDictionary*)headers {
+ NSMutableDictionary *allHeaders = [NSMutableDictionary dictionaryWithDictionary:headers];
+ [allHeaders setValue:destination forKey:@"destination"];
+ [self sendFrame:kCommandSend withHeader:allHeaders andBody:theMessage];
}
- (void)subscribeToDestination:(NSString *)destination {
Something went wrong with that request. Please try again.