Skip to content

WebSocket progress #2721

@ste93

Description

@ste93

websocket:

work done:

  • websocket implementation inside yarp

  • tried compiling yarp into javascript with emscripten
    code:
    emcmake cmake .. -DYCM_DIR=/home/ste/ws/ycm/build -DSKIP_ACE=ON -DBUILD_SHARED_LIBS=OFF

    emmake make -j16 YARP_os

    /home/ste/programs/emsdk/upstream/emscripten/tools/webidl_binder ../Bottle.idl glue

    em++ -s WASM=0 -ferror-limit=0 -s LINKABLE=1 -s EXPORT_ALL=1 -s MODULARIZE=1 -I../src/libYARP_conf/src/ -Isrc/libYARP_conf/src/ -I../src/libYARP_os/src/ lib/libYARP_os.a lib/libYARP_priv_hmac.a ../bottle_idl.cpp -s STRICT=0 --bind -s LLD_REPORT_UNDEFINED --no-entry -o out.js -s EXPORT_NAME=pippo -s USE_PTHREADS -s WASM_BIGINT

    the error returned is

    wasm2js: /b/s/w/ir/cache/builder/emscripten-releases/binaryen/src/passes/I64ToI32Lowering.cpp:471: void wasm::I64ToI32Lowering::visitAtomicCmpxchg(wasm::AtomicCmpxchg *): Assertion `curr->type != Type::i64 && "64-bit AtomicCmpxchg not implemented"' failed.
    em++: error: '/home/ste/programs/emsdk/upstream/bin/wasm2js --emscripten lib.wasm --mvp-features --enable-threads --enable-mutable-globals --enable-bulk-memory --enable-sign-ext' failed (received SIGABRT (-6))

    I think the operation Cmpxchg is not implemented in 64 bits, also with lowering.

    the operation is in wasm (https://github.com/WebAssembly/binaryen) in file https://github.com/WebAssembly/binaryen/blob/main/src/passes/I64ToI32Lowering.cpp

    if you compile em++ with WASM=1 then you can reproduce the error with:
    wasm2js --emscripten lib.wasm --mvp-features --enable-threads --enable-mutable-globals --enable-bulk-memory --enable-sign-ext

  • a small javascript library (https://github.com/ste93/yarp-websocket-library) contains the websocket management together with a small bottle manager.
    it is implemented only for bottle messages, other types of messages are not implemented (like images)_ but images can be retrieved via image src="http://yarp http protocol"
    another functionality implemented is to query the server to get portnames.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions