1

データを送信する必要があるさまざまなユーザー グループがあります。ここでハブの概念を使用することもできましたが、唯一の SignalR Android クライアント ライブラリ "SignalA" https://github.com/erizet/SignalA にはハブの実装がないため、Persisted Connections とそのグループの概念を使用する必要がありました。今、SignalR ドキュメント サイトでこの OnConnected メソッドを参照してください。

protected override Task OnConnected(IRequest request, string connectionId)
{
    return Groups.Add(connectionId, "foo");
}

ユーザーがさまざまなグループに参加できるようにしたいので、接続すると、追加したいグループ名が渡されます。ハードコーディングされた「foo」を使用する代わりに、クライアント側でグループ名を渡し、上記の方法でそれを受け取るにはどうすればよいですか?

また、ハブが実装されている SignalR Java クライアント ライブラリを見つけられなかったので、だれかが教えてくれたらとてもうれしいです。

ありがとう

4

2 に答える 2

3

You have 2 options:

  1. Pass query string parameters (if the java client supports it) as part of the connection information. That way you can pass the list of groups via the query string to join. If you do this then you can use request.QueryString to access the query string and do whatever processing you need.
  2. After connecting you can send a message to the server and handle OnReceived and pass a list of groups.

Either one works.

于 2013-02-22T11:40:37.730 に答える