Skip to content

Commit

Permalink
Update web_rtc_client.dart (#277)
Browse files Browse the repository at this point in the history
  • Loading branch information
clintpurser authored Oct 21, 2024
1 parent b8a2411 commit 4d5f6b9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/src/rpc/web_rtc/web_rtc_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@ class WebRtcClientChannel extends ClientChannelBase {

@override
ClientCall<Q, R> createCall<Q, R>(ClientMethod<Q, R> method, Stream<Q> requests, CallOptions options) {
if (!SessionsClient.unallowedMethods.contains(method.path)) {
options = options.mergedWith(CallOptions(metadata: {SessionsClient.sessionMetadataKey: _sessionId()}));
final sessionMetadata = _sessionId();

// _sessionId will return '' empty if sessions are not enabled.
if (sessionMetadata.isNotEmpty && !SessionsClient.unallowedMethods.contains(method.path)) {
options = options.mergedWith(CallOptions(metadata: {SessionsClient.sessionMetadataKey: sessionMetadata}));
}
options = options.mergedWith(CallOptions(metadata: {'viam_client': getVersionMetadata()}));
return super.createCall(method, requests, options);
Expand Down

0 comments on commit 4d5f6b9

Please sign in to comment.