You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: guides/controllers/readme.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -112,10 +112,10 @@ When a controller method returns another controller, the client receives a proxy
112
112
113
113
```ruby
114
114
# Server:
115
-
server=ChatServerController.new
115
+
chat=ChatServerController.new
116
116
117
117
server.accept do |connection|
118
-
connection.bind(:chat, server)
118
+
connection.bind(:chat, chat)
119
119
end
120
120
121
121
# Client 1:
@@ -135,7 +135,7 @@ end
135
135
136
136
## Passing Controllers as Arguments
137
137
138
-
Because controllers are passed by reference, you can pass them as arguments to enable bidirectional communication. This pattern is useful for event handlers, callbacks, or subscription systems:
138
+
Because controllers are passed by reference, you can pass them as arguments to enable bidirectional communication. When a client passes a proxy as an argument, the server receives a proxy that points back to the client's controller. This enables the server to call methods on the client's controller. This pattern is useful for event handlers, callbacks, or subscription systems:
139
139
140
140
```ruby
141
141
classChatRoomController < Async::Bus::Controller
@@ -149,7 +149,7 @@ class ChatRoomController < Async::Bus::Controller
149
149
# subscriber is a proxy to the client's controller:
0 commit comments