Websocket to POSIX proxy

108 views
Skip to first unread message

Harsh chopra

unread,
Aug 23, 2020, 2:42:16 PM8/23/20
to emscripten-discuss
Hi,

I am trying to generate POSIX sockets proxying in "js" ,  use it in Browser and make it act as a server.

The program under "tools/websocket_to_posix_proxy/" use CMake which works perfect when build with "cmake && make" but when I used "emcamke cmake" , it generate Makefile using "node" as the cross_compiler which is fine but when I use "emmake make" it wont build because "node" dont support posix socket.

So is there any other way things could work?

----------CMAKELIST.TXT------------------

 cmake_minimum_required(VERSION 2.8)
project(websocket_to_posix_proxy)
file(GLOB sourceFiles src/*.cpp src/*.h)
add_executable(websocket_to_posix_proxy ${sourceFiles})
find_package(Threads)
target_link_libraries(websocket_to_posix_proxy ${CMAKE_THREAD_LIBS_INIT})

if (WIN32)
    add_definitions(-D_CRT_SECURE_NO_WARNINGS)
    add_definitions(/wd4200) # "nonstandard extension used: zero-sized array in struct/union"
    target_link_libraries(websocket_to_posix_proxy Ws2_32.lib)
endif()

Sam Clegg

unread,
Aug 23, 2020, 6:57:45 PM8/23/20
to emscripte...@googlegroups.com
I believe the websocket_to_posix_proxy is designed to run natively on the server, so you want to build with regular `cmake` and not `emcake`.    It doesn't run in JS or compile with emscripten.

--
You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-disc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/0c766845-db4b-4dd4-b196-4f8d80aa499an%40googlegroups.com.

Harsh chopra

unread,
Aug 27, 2020, 1:37:20 PM8/27/20
to emscripte...@googlegroups.com
I build a simple posix socket server to listen on localhost and convert the program with emcc to make it compatible on browser(Firefox) but nothing worked,  I tried everything upto my potential and I am really confused now.

Under title - "Full Proxy Sockets over WebSocket Proxy Server"
I believe it's telling us how to allows full POSIX Sockets API access from a web browser.
But I am not able to figure out how.

Please help, guidance required.

Mehdi Sabwat

unread,
Aug 29, 2020, 6:34:14 PM8/29/20
to emscripte...@googlegroups.com

Harsh chopra

unread,
Aug 31, 2020, 9:56:03 AM8/31/20
to emscripte...@googlegroups.com
Yes, I have tried tcp_echo_client.cpp and it works perfectly with "tools/websocket_to_posix_proxy/" .
Other examples look like client programs

Reply all
Reply to author
Forward
0 new messages