(ctx context.Context, conn *websocket.Conn)
| 382 | } |
| 383 | |
| 384 | func readNotification(ctx context.Context, conn *websocket.Conn) (codersdk.GetInboxNotificationResponse, error) { |
| 385 | _, message, err := conn.Read(ctx) |
| 386 | if err != nil { |
| 387 | return codersdk.GetInboxNotificationResponse{}, err |
| 388 | } |
| 389 | |
| 390 | var notif codersdk.GetInboxNotificationResponse |
| 391 | if err := json.Unmarshal(message, ¬if); err != nil { |
| 392 | return codersdk.GetInboxNotificationResponse{}, xerrors.Errorf("unmarshal notification: %w", err) |
| 393 | } |
| 394 | |
| 395 | return notif, nil |
| 396 | } |
no test coverage detected