Skip to content

Conversation

@pekunicki
Copy link

@pekunicki pekunicki commented Nov 11, 2016

Expanded our application by new features:

  • storage current connected users (IdConnection, IP)
  • Logging the actions of users (connecting, disconnecting, drawing, clearing)
  • Displaying number of current clients and logs
  • Additional method to get ip address of user

Paweł Kunicki

@pekunicki pekunicki changed the title Added recognition of the client and logging his action. Added recognition of the client and recording his action. Nov 11, 2016
public class PunsHub : Hub<IPunsClientHandler>
{
static List<string> Image =new List<string>();
public static List<string> Images = new List<string>();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Danger! Can be cross thread called. Use the thread safe collections.

Clients.All.NumberOfUsers(Users.Size());
Clients.All.Action(DateTime.Now.TimeOfDay,ActionType.Connecting.ToString(), id);
Clients.All.Users(Users.GetJson());
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This three calls Client.All can be aggregate in one.

Users.ConnectedClients.Add(id,ip);
Clients.All.NumberOfUsers(Users.Size());
Clients.All.Action(DateTime.Now.TimeOfDay,ActionType.Connecting.ToString(), id);
Clients.All.Users(Users.GetJson());
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can just pass user collection. Let the signalR to serialize.

textarea {
max-width: 280px;
}

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

styled! me gusta:)

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

Successfully merging this pull request may close these issues.

2 participants