hunk.code_window: type WebSocketClient struct {
   	Url                string          // The location of the server like "ws://localhost:8065"
   	ApiUrl             string          // The api location of the server like "ws://localhost:8065/api/v3"
   	ConnectUrl         string          // The websocket URL to connect to like "ws://localhost:8065/api/v3/path/to/websocket"
   	Conn               *websocket.Conn // The WebSocket connection
   	AuthToken          string          // The token used to open the WebSocket
   	Sequence           int64           // The ever-incrementing sequence attached to each WebSocket action
   	PingTimeoutChannel chan bool       // The channel used to signal ping timeouts
   	EventChannel       chan *WebSocketEvent
   	ResponseChannel    chan *WebSocketResponse
   	ListenError        *AppError
   	pingTimeoutTimer   *time.Timer
   }
  
hunk.labels: keep replace replace replace replace replace replace replace replace replace replace keep keep keep
hunk.after_edit: 	Url                string                  // The location of the server like "ws://localhost:8065"
   	ApiUrl             string                  // The API location of the server like "ws://localhost:8065/api/v3"
   	ConnectUrl         string                  // The WebSocket URL to connect to like "ws://localhost:8065/api/v3/path/to/websocket"
   	Conn               *websocket.Conn         // The WebSocket connection
   	AuthToken          string                  // The token used to open the WebSocket connection
   	Sequence           int64                   // The ever-incrementing sequence attached to each WebSocket action
   	PingTimeoutChannel chan bool               // The channel used to signal ping timeouts
   	EventChannel       chan *WebSocketEvent    // The channel used to receive various events pushed from the server. For example: typing, posted
   	ResponseChannel    chan *WebSocketResponse // The channel used to receive responses for requests made to the server
   	ListenError        *AppError               // A field that is set if there was an abnormal closure of the WebSocket connection
  
hunk.file_path: model/websocket_client.go
hunk.type: replace
file: #!/usr/bin/env groovy
  
  @Library('shared-pipelines') _
  import org.mattermost.Utils
  import java.util.*;
  def utils = new org.mattermost.Utils()
  def build = new org.mattermost.BuildCommands()
  def platformStages = new org.mattermost.PlatformStages()
  
  def rndEE = UUID.randomUUID().toString()
  def rndTE = UUID.randomUUID().toString()
  def mmBuilderServer = 'mattermost/mattermost-build-server:oct-18-2019'
  def mmBuilderWebapp = 'mattermost/mattermost-build-webapp:oct-2-2018'
  
  pipeline {
    agent {
      label 'default-mm-builder'
    }
  
    options {
      buildDiscarder(logRotator(numToKeepStr: '3'))
      timeout(time: 2, unit: 'HOURS')
    }
  
    environment {
      COMPOSE_PROJECT_NAME="${rnd}-${env.BUILD_NUMBER}"
      GOPATH = "/go"
    }
  
    stages {
      stage('Setup') {
        steps {
          script {
            platformStages.platformEcho()
          }
        }
      }
  
      stage('Build') {
        failFast true
        parallel {
          stage ('Build EE') {
            agent {
              label 'default-mm-builder'
            }
            steps {
              script {
                forcefullyCleanWorkspace(mmBuilderServer)
                platformStages.platformCheckoutTE(env.BRANCH_NAME)
                platformStages.platformCheckoutEE(env.BRANCH_NAME)
                platformStages.platformCheckoutRedux(env.BRANCH_NAME)
                SERVER_GIT_COMMIT=platformStages.platformServerCommitHash()
                try {
                  platformStages.newPlatformBuild(env.BRANCH_NAME + '.' + env.BUILD_NUMBER + '.' + SERVER_GIT_COMMIT, rndEE, false, mmBuilderServer, mmBuilderWebapp)
                } finally {
                  platformStages.platformPublishResults()
                  platformStages.platformCleanDockerCompose(rndEE)
                }
              }
              stash includes: 'src/github.com/mattermost/mattermost-server/dist/**', name: 'eedist'
            }
          }
          stage ('Build TE') {
            agent {
              label 'default-mm-builder'
            }
            steps {
              script {
                forcefullyCleanWorkspace(mmBuilderServer)
                platformStages.platformCheckoutTE(env.BRANCH_NAME)
                platformStages.platformCheckoutRedux(env.BRANCH_NAME)
                SERVER_GIT_COMMIT=platformStages.platformServerCommitHash()
                try {
                  platformStages.newPlatformBuild(env.BRANCH_NAME + '.' + env.BUILD_NUMBER + '.' + SERVER_GIT_COMMIT, rndTE, false, mmBuilderServer, mmBuilderWebapp)
                } finally {
                  platformStages.platformPublishResults()
                  platformStages.platformCleanDockerCompose(rndTE)
                }
              }
              stash includes: 'src/github.com/mattermost/mattermost-server/dist/**', name: 'tedist'
            }
          }
        }
      }
  
      stage ('Push EE') {
        steps {
          node('master') {
            forcefullyCleanWorkspace(mmBuilderServer)
            unstash 'eedist'
            script {
              platformStages.pushToS3('mattermost-platform/' + env.BRANCH_NAME, 'mattermost-enterprise-*',false)
            }
          }
        }
      }
      stage ('Push TE') {
        steps {
          node('master') {
            forcefullyCleanWorkspace(mmBuilderServer)
            unstash 'tedist'
            script {
              platformStages.pushToS3('mattermost-platform/' + env.BRANCH_NAME, 'mattermost-team-*',false)
            }
          }
        }
      }
      stage ('CleanCloudfront') {
        steps {
          node('master') {
            script {
              platformStages.cleanCloudfrontCache('mattermost-platform/' + env.BRANCH_NAME)
            }
          }
        }
      }
  
      stage ('Build Docker Images') {
        agent {
          label 'default-mm-builder'
        }
        steps {
          script {
            forcefullyCleanWorkspace(mmBuilderServer)
            platformStages.platformCheckoutTE(env.BRANCH_NAME)
          }
          dir('src/github.com/mattermost/mattermost-server') {
            withCredentials([usernamePassword(credentialsId: 'matterbuild-docker-hub', usernameVariable: 'DOCKER_USER', passwordVariable: 'DOCKER_PASS')]) {
              sh 'docker login --username ${DOCKER_USER} --password ${DOCKER_PASS}'
              sh """
              export TAG='${env.BRANCH_NAME}'
              docker build --no-cache --build-arg MM_PACKAGE=https://releases.mattermost.com/mattermost-platform/${env.BRANCH_NAME}/mattermost-enterprise-linux-amd64.tar.gz -t mattermost/mattermost-enterprise-edition:\${TAG} build
              docker push mattermost/mattermost-enterprise-edition:\${TAG}
              """
              sh """
              export TAG='${env.BRANCH_NAME}'
              docker build --no-cache --build-arg MM_PACKAGE=https://releases.mattermost.com/mattermost-platform/${env.BRANCH_NAME}/mattermost-team-linux-amd64.tar.gz -t mattermost/mattermost-team-edition:\${TAG} build
              docker push mattermost/mattermost-team-edition:\${TAG}
              docker logout
              """
            }
          }
        }
      }
    }
  
    post {
      cleanup {
        forcefullyCleanWorkspace(mmBuilderServer)
      }
    }
  }
  
  
  def forcefullyCleanWorkspace(String imageToUse) {
    return withDockerContainer(
      image: imageToUse,
      args: '-u root'
    ) {
      ansiColor('xterm') {
        sh """#!/bin/bash -e
          if [ -d "\$WORKSPACE" ]
          then
            rm -rfv \$WORKSPACE/*
          fi
        """
      }
    }
  }
  