package com.vetti.socket.util;

import javax.websocket.Session;
import java.util.concurrent.ConcurrentHashMap;

/**
 * 客户端对话管理
 */
public class SessionManager {

    private static final ConcurrentHashMap<String, Session> clients = new ConcurrentHashMap<>();

    public static void add(Session s) {
        clients.put(s.getId(), s);
    }

    public static void remove(String id) {
        clients.remove(id);
    }

    public static Session get(String id) {
        return clients.get(id);
    }

}
