hunk.code_window: 	SOCKET_MAX_MESSAGE_SIZE_KB  = 8 * 1024 // 8KB
   	PING_TIMEOUT_BUFFER_SECONDS = 5
   )
   type WebSocketClient struct {
  
hunk.labels: keep keep keep add keep
hunk.after_edit: // WebSocketClient stores the necessary information required to
   // communicate with a WebSocket endpoint.
  
hunk.file_path: model/websocket_client.go
hunk.type: add
file: // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
  // See LICENSE.txt for license information.
  
  package config
  
  import (
  	"testing"
  
  	"github.com/stretchr/testify/assert"
  
  	"github.com/mattermost/mattermost-server/v5/model"
  )
  
  func TestEmitter(t *testing.T) {
  	var e emitter
  
  	expectedOldCfg := &model.Config{}
  	expectedNewCfg := &model.Config{}
  
  	listener1 := false
  	id1 := e.AddListener(func(oldCfg, newCfg *model.Config) {
  		assert.Equal(t, expectedOldCfg, oldCfg)
  		assert.Equal(t, expectedNewCfg, newCfg)
  		listener1 = true
  	})
  
  	listener2 := false
  	id2 := e.AddListener(func(oldCfg, newCfg *model.Config) {
  		assert.Equal(t, expectedOldCfg, oldCfg)
  		assert.Equal(t, expectedNewCfg, newCfg)
  		listener2 = true
  	})
  
  	e.invokeConfigListeners(expectedOldCfg, expectedNewCfg)
  	assert.True(t, listener1, "listener 1 not called")
  	assert.True(t, listener2, "listener 2 not called")
  
  	e.RemoveListener(id2)
  
  	listener1 = false
  	listener2 = false
  	e.invokeConfigListeners(expectedOldCfg, expectedNewCfg)
  	assert.True(t, listener1, "listener 1 not called")
  	assert.False(t, listener2, "listener 2 should not have been called")
  
  	e.RemoveListener(id1)
  
  	listener1 = false
  	listener2 = false
  	e.invokeConfigListeners(expectedOldCfg, expectedNewCfg)
  	assert.False(t, listener1, "listener 1 should not have been called")
  	assert.False(t, listener2, "listener 2 should not have been called")
  }
  