Skip to content

Commit

Permalink
Replacing connectionWithURL: with connectionWithURLString:
Browse files Browse the repository at this point in the history
The method to create a connection from a URL string is named [SRConnection connectionWithURLString:] - fixing the example code to use it.
richardgroves authored Jun 20, 2016
1 parent 73bcbfd commit cc20dfe
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -85,7 +85,7 @@ public class MyConnection : PersistentConnection
#import "SignalR.h"

//Client
SRConnection *connection = [SRConnection connectionWithURL:@"http://localhost/mysite/echo"];
SRConnection *connection = [SRConnection connectionWithURLString:@"http://localhost/mysite/echo"];

// Register for connection lifecycle events
[connection setStarted:^{
@@ -131,7 +131,7 @@ public class Chat : Hub
#import "SignalR.h"

// Connect to the service
SRHubConnection *hubConnection = [SRHubConnection connectionWithURL:@"http://localhost/mysite"];
SRHubConnection *hubConnection = [SRHubConnection connectionWithURLString:@"http://localhost/mysite"];
// Create a proxy to the chat service
SRHubProxy *chat = [hubConnection createHubProxy:@"chat"];
[chat on:@"addMessage" perform:self selector:@selector(addMessage:)];
@@ -176,7 +176,7 @@ id qs = @{
@"param1": @1,
@"param2": @"another"
};
SRConnection *connection = [SRConnection connectionWithURL:@"http://localhost/mysite" queryString:qs];
SRConnection *connection = [SRConnection connectionWithURLString:@"http://localhost/mysite" queryString:qs];
```

#### Hub Connections
@@ -185,7 +185,7 @@ id qs = @{
@"param1": @1,
@"param2": @"another"
};
SRHubConnection *hubConnection = [SRHubConnection connectionWithURL:@"http://localhost/mysite" queryString:qs];
SRHubConnection *hubConnection = [SRHubConnection connectionWithURLString:@"http://localhost/mysite" queryString:qs];
```
### Customizing Request Headers
@@ -196,11 +196,11 @@ id headers = @{
@"param1": @1,
@"param2": @"another"
};
SRConnection *connection = [SRConnection connectionWithURL:@"http://localhost/mysite"];
SRConnection *connection = [SRConnection connectionWithURLString:@"http://localhost/mysite"];
[connection setHeaders:headers];
//Alternative Usage
SRConnection *connection = [SRConnection connectionWithURL:@"http://localhost/mysite"];
SRConnection *connection = [SRConnection connectionWithURLString:@"http://localhost/mysite"];
[connection addValue:@"1" forHTTPHeaderField:@"param1"];
[connection addValue:@"another" forHTTPHeaderField:@"param2"];
```
@@ -211,11 +211,11 @@ id headers = @{
@"param1": @1,
@"param2": @"another"
};
SRHubConnection *hubConnection = [SRHubConnection connectionWithURL:@"http://localhost/mysite"];
SRHubConnection *hubConnection = [SRHubConnection connectionWithURLString:@"http://localhost/mysite"];
[hubConnection setHeaders:headers];

//Alternative Usage
SRHubConnection *hubConnection = [SRHubConnection connectionWithURL:@"http://localhost/mysite"];
SRHubConnection *hubConnection = [SRHubConnection connectionWithURLString:@"http://localhost/mysite"];
[hubConnection addValue:@"1" forHTTPHeaderField:@"param1"];
[hubConnection addValue:@"another" forHTTPHeaderField:@"param2"];
```

0 comments on commit cc20dfe

Please sign in to comment.