Exemple #1
0
    public void Connect()
    {
        if (State != HubState.idle || string.IsNullOrEmpty(m_uri))
        {
            Close();
            return;
        }
        if (IsConnected == true)
        {
            return;
        }

        C2H.HubConnectHeader header = new C2H.HubConnectHeader();
        header.access_token = m_token;
        header.nickname     = Network.PlayerInfo.nickname;
        header.account_idx  = SHSavedData.AccountIdx;

        m_connection = new Connection(new Uri(m_uri), HubName);
        m_connection.AuthenticationProvider = new HeaderAuthentication(header);

        m_connection.OnConnected    += OnConnected;
        m_connection.OnClosed       += OnClosed;
        m_connection.OnError        += OnError;
        m_connection.OnStateChanged += OnStateChange;
        m_connection.Open();


        State = HubState.connecting;
    }
Exemple #2
0
 public HeaderAuthentication(C2H.HubConnectHeader connect_header)
 {
     header = connect_header;
 }