Example #1
0
        public ActionResult Get(Guid id)
        {
            var canvas = storage.GetById(id)?.Canvas;

            if (canvas == null)
            {
                return(NotFound());
            }
            return(File(canvas.GetBytes(), "image/png"));
        }
Example #2
0
        public async Task UserJoin(Guid id)
        {
            var connection = connectionStorage.GetById(Context.ConnectionId);

            if (connection.Room != null)
            {
                connection.Room.Leave(connection);
            }
            var room = activeRoomStorage.GetById(id);

            if (room != null)
            {
                room.Join(connection);
                await Groups.AddToGroupAsync(Context.ConnectionId, id.ToString()).ConfigureAwait(false);

                await Clients.Group(id.ToString()).UserJoined(connection.Room).ConfigureAwait(false);
            }
        }