package com.gyee.wisdom.dataadapter.websocket.session;

import lombok.Data;

import java.util.*;

@Data
public class WisdomStompSession {
    private String sessionId;
    private String clientIp;
    private Date createTime;
    private String userName;
    private Date loginTime;

    private Set<String> topics;

    public void subscribeTopic(String topic) {
        if (topics == null)
            topics = new HashSet<>();
        if (topics.contains(topic) == false)
            topics.add(topic);
    }

    public void unSubscribeTopic(String topic) {
        if (topics != null && topics.contains(topic))
            topics.remove(topic);
    }

}
