O'Reilly logo

Isomorphic Go by Kamesh Balasubramanian

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Implementing the live chat's client-side functionality

Now that we've covered the server-side functionality needed to implement the chat bot, it's time focus on the live chat feature from the perspective of the client-side web application.

Inside the InitialPageLayoutControls function, we add an event listener on the click event to the live chat icon found on the top bar:

  liveChatIcon := env.Document.GetElementByID("liveChatIcon").(*dom.HTMLImageElement)  liveChatIcon.AddEventListener("click", false, func(event dom.Event) {    chatbox := env.Document.GetElementByID("chatbox")    if chatbox != nil {      return    }    go chat.StartLiveChat(env)  })

If the live chat feature has already been activated, the chatbox div element will already exist, that is, it ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required