Skip to content
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

Feature request: Have a connection identifier on the server based on a client connection #25

Open
PeterPann23 opened this issue Sep 10, 2022 · 3 comments

Comments

@PeterPann23
Copy link

When establishing a connection it would be nice if one could add client metadata to the connection like a Connection Identifier (CID).
At the moment it's hard to identify a client connection on the server side. At the moment we make this part of the message but if the server gets a client message and needs to "send updates to a specific other" connected client then having a CID would be good.

await using var client = new PipeClient(pipeName) {
ClientMeta = new ClientMeta() { MachineName=Enviroment.MachineName, Role="MyRole", ...}
};

One could add the CID in the server connection handshake, the service already maintains a state for connected clients

When implementing something like this, you could do:
await server.ConnectedClients.Where(w=>s.MetaData.Role=="SomeRole").SendMsgAsync(..)

@HavenDV
Copy link
Owner

HavenDV commented Sep 10, 2022

Maybe this will work for you?

public string GetImpersonationUserName()
{
if (PipeStream is not NamedPipeServerStream serverStream)
{
throw new InvalidOperationException($"{nameof(PipeStream)} is not {nameof(NamedPipeServerStream)}.");
}
return serverStream.GetImpersonationUserName();
}

@PeterPann23
Copy link
Author

PeterPann23 commented Sep 10, 2022 via email

@kaddrison
Copy link

Was this every done? - I have 2 apps on the same machine sending to the server - which is OK for the message as I can put the app in it but I can't monitor the disconnect connect as I don't get which app - I can send a message on connect but I can't monitor disconnect

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants