libreoffice-online/wasm/wasmapp.hpp
Tor Lillqvist 48c96e70ca More WASM hacking
Apparently handle_cool_message() gets called from a web worker thread
and then using emscripten_run_script() in wasmapp.cpp to run a JS
snippet that refers to the 'window' variable will not work. That
variable exists only in the main thread. So use MAIN_THREAD_EM_ASM()
instead.

Hardcode the document URL for now also in wasmapp.cpp.

Try to send the HULLO message from COOLWSD::innerMain().

Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: Ic48042c6d0c6239a3b82e74f0565056a15f3d98d
2023-01-26 22:01:14 +02:00

37 lines
975 B
C++

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include <config.h>
#include <chrono>
#include <thread>
#include <FakeSocket.hpp>
#include <Kit.hpp>
#include <Log.hpp>
#include <COOLWSD.hpp>
#include <Protocol.hpp>
#include <SetupKitEnvironment.hpp>
#include <Util.hpp>
#include <LibreOfficeKit/LibreOfficeKit.hxx>
#include <Poco/Base64Encoder.h>
#ifdef __EMSCRIPTEN__
#include <emscripten.h>
#include <emscripten/bind.h>
#include <emscripten/html5.h>
#include <emscripten/val.h>
#endif
extern int coolwsd_server_socket_fd;
extern const char* user_name;
extern "C" void handle_cool_message(const char *string_value);
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */