// listen for message from the webview
wkWebview.configuration.userContentController = userContentController
wkWebview.configuration.userContentController.add(self, name: nativeToWebHandler)
// parse session_id and pass to your backend
public func userContentController(_ userContentController: WKUserContentController,
                                      didReceive message: WKScriptMessage) {
        guard
            let body = message.body as? [String: String],
            message.name.lowercased() == nativeToWebHandler.lowercased(),
            let sessionId = body["session_id"]
  
            // pass to your backend
            // ...
        else {
            return
        }
}