I need get server events from my service, but I don't know how to do this for TS and JS.
I understand correctly, after authentication, I receive messages for my user?
Оr should I do like the c# client?
You just need to authenticate with the browser once as the JsonServiceClient/ServerEventClient automatically shares and sends the same cookies and authenticated user session that's established with the browser.
So if you authenticate via any means normally, you will connect as the authenticated user to the event-stream. e.g. hitting the /auth/twitter, /auth/facebook, /auth/github routes will authenticate via OAuth and when it redirects back to the http://chat.servicestack.net home page it will connect as the authenticated user.
Some options for authenticating with the
var client = new JsonServiceClient(baseUrl);
client.userName = userName;
client.password = password;
var request = new Authenticate();
request.provider = "credentials";
request.userName = userName;
request.password = password;
var authResponse = await client.post(new Authenticate());
var jwtToken = authResponse.bearerToken;
Note: setBearerToken() was just added in v0.0.28