Skip to content

Commit 7adcf67

Browse files
committed
Add ResolveStreamUrl option to match TypeScript ServerEventsClient
1 parent ada5815 commit 7adcf67

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/ServiceStack.Client/ServerEventsClient.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,7 @@ public partial class ServerEventsClient : IDisposable
9696

9797
public string ConnectionDisplayName => ConnectionInfo != null ? ConnectionInfo.DisplayName : "(not connected)";
9898

99-
public string EventStreamPath { get; set; }
100-
public string EventStreamUri { get; private set; }
99+
public Func<string, string> ResolveStreamUrl { get; set; }
101100

102101
public string BaseUri
103102
{
@@ -133,6 +132,15 @@ private void BuildEventStreamUri()
133132
.AddQueryParam("channels", string.Join(",", this.channels));
134133
}
135134

135+
public string EventStreamPath { get; set; }
136+
137+
private string eventStreamUri;
138+
public string EventStreamUri
139+
{
140+
get => ResolveStreamUrl != null ? ResolveStreamUrl(eventStreamUri) : eventStreamUri;
141+
private set => eventStreamUri = value;
142+
}
143+
136144
public IServiceClient ServiceClient { get; set; }
137145
public DateTime LastPulseAt { get; set; }
138146

@@ -566,6 +574,7 @@ public void ProcessResponse(Stream stream)
566574
}
567575

568576
private ServerEventMessage currentMsg;
577+
569578
void ProcessLine(string line)
570579
{
571580
if (line == null) return;

0 commit comments

Comments
 (0)