Interact with new sub process from main process.

#1

Hi,

I am using autobahn with twisted and my server is working perfectly. Now I need to start a web sever and web client using twisted.web apis on a new process.

I am seeing the reactor.spawnProcess api and trying hard to make it work from last three days, but so many different documentation are confusing me and I am not able to achieve what I need from any of them.

Here is what I have.

Running autobahn server and twisted server (for clustering) on one main process, simple chat server but not as pub-sub server.

I am using python 2.7 with virtualEnv.

What we need:

Now I need to run a web server on 8088 port on a new sub process and then interact with it from main process. Why: The Chat server have user session Ids and need to authorize it from the web server (Django server on other box on different ip) and then django server will call back the chat server [http web server] to provide the details about users. We need to run this web server on a new sub process.

So two parts: One create a new sub process with spawnProcess and listen http server on 8088 port. and Then chat server (main process) interaction (send data and receive data) with sub process running http server (port 8088).

I am very confused with executable params I guess, and how to interact part. Keep in mind that we are using virtualEnv in the whole scenario.

Incase anything is not clear, please feel free to write me back.

Any help would be appreciate.

0 Likes

#2

The first issue solved to run the web server on a sub process:

reactor.spawnProcess(processProtocolSubClassIns, sys.executable, [sys.executable, ‘WebServer.py’])

WebServer.py // full path.

Now second issue, how to communicate between main process (Chat server) to sub process (web server).

Let me know incase any one could help me.

···

On Friday, September 12, 2014 1:01:25 PM UTC-4, Chuck James wrote:

Hi,

I am using autobahn with twisted and my server is working perfectly. Now I need to start a web sever and web client using twisted.web apis on a new process.

I am seeing the reactor.spawnProcess api and trying hard to make it work from last three days, but so many different documentation are confusing me and I am not able to achieve what I need from any of them.

Here is what I have.

Running autobahn server and twisted server (for clustering) on one main process, simple chat server but not as pub-sub server.

I am using python 2.7 with virtualEnv.

What we need:

Now I need to run a web server on 8088 port on a new sub process and then interact with it from main process. Why: The Chat server have user session Ids and need to authorize it from the web server (Django server on other box on different ip) and then django server will call back the chat server [http web server] to provide the details about users. We need to run this web server on a new sub process.

So two parts: One create a new sub process with spawnProcess and listen http server on 8088 port. and Then chat server (main process) interaction (send data and receive data) with sub process running http server (port 8088).

I am very confused with executable params I guess, and how to interact part. Keep in mind that we are using virtualEnv in the whole scenario.

Incase anything is not clear, please feel free to write me back.

Any help would be appreciate.

0 Likes