-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RSDK-8293] Pass in Connection to Answerer in WebRTC Server #410
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some comments but looks pretty good!
rpc/dial_options.go
Outdated
@@ -280,3 +283,10 @@ func WithForceDirectGRPC() DialOption { | |||
o.disableDirect = false | |||
}) | |||
} | |||
|
|||
// WithConn provides a preexisting connection to use. This option forces the webrtcSignalingAnswerer to not dial or manage a connection. | |||
func WithConn(conn ClientConn) DialOption { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe ExternalSignalerConn? we should be clear that this would be used for the external signaler answerer
rpc/wrtc_signaling_answerer.go
Outdated
@@ -71,6 +76,11 @@ func newWebRTCSignalingAnswerer( | |||
bgWorkers: bgWorkers, | |||
logger: logger, | |||
} | |||
if options.conn != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the internal signaler answer shouldn't be using the same connection - it is instantiated here
Lines 659 to 665 in cf6c56e
server.webrtcAnswerers = append(server.webrtcAnswerers, newWebRTCSignalingAnswerer( | |
address, | |
internalSignalingHosts, | |
server.webrtcServer, | |
answererDialOpts, | |
config, | |
utils.Sublogger(logger, "signaler.internal"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't require any change does it, since its instantiation has its own fresh set of options passed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks generally good, will hold off on approving until the corresponding RDK pr is in
rpc/dial_options.go
Outdated
@@ -280,3 +283,10 @@ func WithForceDirectGRPC() DialOption { | |||
o.disableDirect = false | |||
}) | |||
} | |||
|
|||
// WithConn provides a preexisting connection to use. This option forces the webrtcSignalingAnswerer to not dial or manage a connection. | |||
func WithConn(externalSignalerConn ClientConn) DialOption { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename WithConn
as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with a suggestion
rpc/dial_options.go
Outdated
@@ -64,6 +64,9 @@ type dialOptions struct { | |||
// interceptors | |||
unaryInterceptor grpc.UnaryClientInterceptor | |||
streamInterceptor grpc.StreamClientInterceptor | |||
|
|||
// conn can be used to force the webrtcSignalingAnswerer to use a preexisting connection instead of dialing and managing its own. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// conn can be used to force the webrtcSignalingAnswerer to use a preexisting connection instead of dialing and managing its own. | |
// signalingConn can be used to force the webrtcSignalingAnswerer to use a preexisting connection instead of dialing and managing its own. |
This PR allows for a preexisting connection to be passed to the constructor for our WebRTC signaling answerer to use via a dial option.
Testing
4 cases:
@cheukt and I ran the first tests by running viam-server on my laptop while connected to the Viam-Guest WiFi. He ran a client Go script on his laptop connected to the Viam WiFi. The client was able to connect to the robot via WebRTC both times.