/moc

mini but extensiable online communicate system(Server on Linux, Client on Linux, macos, ios, android...)

Primary LanguageC

moc 
=== - mini but extensiable online communication system,
      we use it on our game mobile app.
      most codes stolen from nmdb, clearsilver... thanks them a lot.


design
------
    Based on nmdb, one server can hold multi backend module
    (per module: one plugin, one message queue, one thread);

    And, one module can exist on many process or many servers
    for load share.

    consider doc/net-skeleton.png and the codes for more information.


directory
---------
    moc/
    |-- server             server daemon code (only tested on GNU/Linux)
    |-- plugin             server application logic module code
    |-- client             client API code (tested on Linux, ios, android)
    |   `-- clearsilver    client API depend on clearsilver's util library
    |-- conf               configration file
    |-- demo               simple application demo(use client API)
    `-- doc                documentation



depend
------
    The server depend on cmoon's mnl library currently. so, checkout
    git://github.com/bigml/cmoon.git into the moc's parent directory.
    and do the rest lib/mnl's compile fuck, then, every thing goes ok.

    Client is very easy to compile, gcc, xcode, ndk can compile client
    directory to a static library.
    Take a look on client/Makefile first, you need to manually define
    some macros like EVENTLOOP, std=c99... on non-Linux enviorment.

    And then, compile the chat demo, modify mocclient.hdf config file,
    run it, hack it, have fun!



multi app dev
-------------
    Following steps can hold multiply application develop at the same time.
    Which seprated public and application code clearly.
        (MOC_PATH hold the moc public base code.
         appxmoc hold the x application's logic code.
         you can make appymoc, appzmoc, ...)

    0
    -
    mkdir appxmoc;
    cd appxmoc;

    1
    -
    ln -s MOC_PATH/server .
    ln -s MOC_PATH/client .

    cp -rf MOC_PATH/conf .
    cp MOC_PATH/Makefile .

    cp -rf MOC_PATH/plugin .
    cd plugin/; rm skeleton_*; ln -s MOC_PATH/plugin/skeleton* .
    cd private/; rm skeleton_*; ln -s MOC_PATH/plubin/private/skeleton* .

    mkdir demo;
    cd demo;
    ln -s MOC_PATH/demo/Makefile .
    ln -s MOC_PATH/demo/*.c .
    ln -s ../conf/mocclient.hdf .