Skip to content

Commit 062a429

Browse files
authored
minor change
1 parent e9ac4d5 commit 062a429

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

aspnetcore/signalr/swift-client.md

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -60,18 +60,6 @@ let connection = HubConnectionBuilder()
6060
try await connection.start()
6161
```
6262

63-
### Cross-origin connections (CORS)
64-
65-
Typically, browsers load connections from the same domain as the requested page. However, there are occasions when a connection to another domain is required.
66-
67-
When making [cross domain requests](xref:signalr/security#cross-origin-resource-sharing), the client code ***must*** use an absolute URL instead of a relative URL. For cross domain requests, change `.withUrl(url: "/chathub")` to `.withUrl(url: "https://{App domain name}/chathub")`.
68-
69-
To prevent a malicious site from reading sensitive data from another site, [cross-origin connections](xref:security/cors) are disabled by default. To allow a cross-origin request, enable [CORS](xref:security/cors):
70-
71-
[!code-csharp[](javascript-client/samples/6.x/SignalRChat/Program.cs?highlight=8-18,35-36,39)]
72-
73-
<xref:Microsoft.AspNetCore.Builder.CorsMiddlewareExtensions.UseCors%2A> must be called before calling <xref:Microsoft.AspNetCore.Builder.HubEndpointRouteBuilderExtensions.MapHub%2A>.
74-
7563
## Call client methods from the hub
7664

7765
To receive messages from the server, register a handler using the `on` method. The on method takes the name of the hub method and a closure that will be executed when the server calls that method.
@@ -149,8 +137,8 @@ public class ChatHub : Hub
149137
To receive a stream of data from the server, use the `stream` method. The method returns a stream that you can iterate over asynchronously:
150138

151139
```swift
152-
let stream: any StreamResult<String> = try await connection.stream(method: "StreamMethod")
153-
for try await item in stream.stream {
140+
let streamResult: any StreamResult<String> = try await connection.stream(method: "StreamMethod")
141+
for try await item in streamResult.stream {
154142
print("Received item: \(item)")
155143
}
156144
```

0 commit comments

Comments
 (0)