anchor.diff:    const closeReplPage = () => {
       replPage.fadeOut('slow', () => {
         kataPage.fadeIn('slow', () => {
  -        replFini();
  +        // Empty the dom element so next [repl] click is clean.
  +        $('#repl-terminal').empty();
         });
       });
     };
   
     // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
   
  -  const replInit = () => {
  -    // Trying to put Terminal inside a jQuery dialog is, empirically,
  -    // very tricksy (because of CSS z-Index issues I think).
  -    cd.saveCodeFromSyntaxHighlightEditors();
  -    setSessionId();
  -    const element = document.getElementById('repl-terminal');
  -    const terminal = createTerminalIn(element);
  -    const repl = new Repl(terminal);
  -    repl.create().then(() => {
  -      const socket = new WebSocketMonitor(terminal);
  -      socket.open();
  -      resumeButton.unbind().click(() => {
  -        socket.close();
  -        repl.delete();
  -        closeReplPage();
  -      });
  +  const replInit = (terminal,sid) => {
  +    const repl = new Repl(terminal,sid);
  +    const socket = new WebSocketMonitor(terminal,sid);
  +    resumeButton.unbind().click(() => {
  +      socket.close();
  +      repl.delete();
  +      closeReplPage();
       });
  -  };
  -
  -  const replFini = () => {
  -    // Empty the dom element so next [repl] click is clean.
  -    $('#repl-terminal').empty();
  -  };
  -
  -  const setSessionId = () => {
  -    // If the repl docker container's id was based *only* on the kata-id,
  -    // then creating a new repl could  fail if there was a very recent
  -    // [resume], which caused a repl DELETE request, but the docker daemon
  -    // had not yet actually deleted the repl container.
  -    // So the repl and socket Urls for a repl session have a random suffix.
  -    sessionId = Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0,6);
  +    repl.create().then(() => socket.open());
     };
   
     //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
   
  -  function WebSocketMonitor(terminal) {
  -    this.url = `ws://${replUrl()}`;
  +  function WebSocketMonitor(terminal,sid) {
  +    this.url = `ws://${replUrl(sid)}`;
       this.terminal = terminal;
     };
   
  -  WebSocketMonitor.prototype.open = function() { //url, terminal) {
  +  WebSocketMonitor.prototype.open = function() {
       const that = this;
       this.socket = new WebSocket(this.url);
       this.socket.onopen = function(_event) {
  
positive.code: 'use strict';
  $(() => {
  
    const kataPage = $('#kata-page');
    const replPage = $('#repl-page');
    const resumeButton = $('.resume-button', replPage);
    const kataId = "<%= @kata.id %>";
    const replUrl = () => `${location.hostname}/repler/${kataId}-${sessionId}`;
    let sessionId = null;
  
    cd.openReplPage = () => {
      kataPage.fadeOut('slow', () => {
        replPage.fadeIn('slow', () => {
          replInit();
        });
      });
    };
  
negative.code:     this.socket.onclose = function(event) {
        const NGINX_TIMEOUT_CODE = 1006;
        if (event.code === NGINX_TIMEOUT_CODE) {
          that.terminal.greenWriteLn('WebSocket timed out');
          that.start(); // silently restart
        }
      };
      this.socket.onerror = function(event) {
  