Skip to content

Commit

Permalink
-s PROXY_POSIX_SOCKETS option: Allows POSIX sockets support via proxy…
Browse files Browse the repository at this point in the history
…ing the calls out to a sockets proxy bridge via WebSockets
  • Loading branch information
juj committed Jan 16, 2019
1 parent ac00e06 commit bbf53ca
Show file tree
Hide file tree
Showing 17 changed files with 3,874 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/library.js
Original file line number Diff line number Diff line change
Expand Up @@ -3295,6 +3295,7 @@ LibraryManager.library = {
// arpa/inet.h
// ==========================================================================

#if PROXY_POSIX_SOCKETS == 0
// old ipv4 only functions
inet_addr__deps: ['_inet_pton4_raw'],
inet_addr: function(ptr) {
Expand Down Expand Up @@ -4037,6 +4038,8 @@ LibraryManager.library = {
0x0b00000a, 0x0c00000a, 0x0d00000a, 0x0e00000a] /* 0x0100000a is reserved */
},

#endif // PROXY_POSIX_SOCKETS == 0

// pwd.h

getpwnam: function() { throw 'getpwnam: TODO' },
Expand Down
3 changes: 3 additions & 0 deletions src/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,9 @@ var SOCKET_WEBRTC = 0;
// where addr and port are derived from the socket connect/bind/accept calls.
var WEBSOCKET_URL = 'ws://';

// If 1, the POSIX sockets API uses a proxy bridge to proxy sockets calls
var PROXY_POSIX_SOCKETS = 0;

// A string containing a comma separated list of WebSocket subprotocols
// as would be present in the Sec-WebSocket-Protocol header.
var WEBSOCKET_SUBPROTOCOL = 'binary';
Expand Down
13 changes: 13 additions & 0 deletions system/include/emscripten/posix_socket.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#pragma once

#include "websocket.h"

#ifdef __cplusplus
extern "C" {
#endif

extern EMSCRIPTEN_RESULT emscripten_init_websocket_to_posix_socket_bridge(const char *bridgeUrl);

#ifdef __cplusplus
}
#endif
Loading

0 comments on commit bbf53ca

Please sign in to comment.