hunk.code_window: var conn = null;
   var connectFailCount = 0;
   var pastFirstInit = false;
   export function initialize() {
       if (window.WebSocket && !conn) {
           let protocol = 'ws://';
  
hunk.labels: keep keep add keep keep keep keep
hunk.after_edit: var manuallyClosed = false;
  
hunk.file_path: webapp/action_creators/websocket_actions.jsx
hunk.type: add
file: package test_helpers
  
  import (
  	"io/ioutil"
  	"os"
  )
  
  type TempFile struct {
  	*os.File
  }
  
  func NewTempFile(content []byte) (*TempFile, error) {
  	f, err := ioutil.TempFile("", "graceful-test")
  	if err != nil {
  		return nil, err
  	}
  
  	f.Write(content)
  	return &TempFile{f}, nil
  }
  
  func (tf *TempFile) Unlink() {
  	if tf.File != nil {
  		os.Remove(tf.Name())
  		tf.File = nil
  	}
  }
  