Coder Social home page Coder Social logo

php-ws's People

Contributors

karminski avatar payden avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

php-ws's Issues

compile error on mac os.

can not compile (make) with this error

cc ${wl}-flat_namespace ${wl}-undefined ${wl}suppress -o .libs/ws.so -bundle  .libs/ws.o .libs/php_ws.o  -L/lib /usr/local/lib/libwebsock.dylib /usr/local/lib/libevent_openssl.dylib /usr/local/lib/libevent.dylib /usr/local/lib/libevent_pthreads.dylib  -Wl,-rpath -Wl,/lib
ld: warning: directory not found for option '-L/lib'
duplicate symbol _ws_object_handlers in:
    .libs/ws.o
    .libs/php_ws.o
duplicate symbol _ws_client_object_handlers in:
    .libs/ws.o
    .libs/php_ws.o
duplicate symbol _ws_message_object_handlers in:
    .libs/ws.o
    .libs/php_ws.o
ld: 3 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

How to add custom events?

Hi Payden,

I have a web application written in PHP that uses long polling to send data out to the clients, this uses one process per client, looking for changes in a DB. Returning either data or a 204 HTTP response after some timeout after which the clients connect again.

It uses a lot of resources and I have long been looking for a good way implement an event based Websocket solution, without having to redo all my existing php code.

After trying the echo example with your php-ws extension I think this extension could be very useful, but I somehow lack a method of interrupting the event loop if new data becomes available on the server.
So I would like to do one of the following if it is possible:

  1. Register custom events/callbacks before calling run?
  2. Make my own event loop, calling a poll method instead of run.
  3. Wait for sockets to be ready for read?
  4. Add a simple timer callback?

Is any of this possible?
As far as I can see I can interrupt the process with a INT signal, but that would require another process to do this or am I wrong?

Otherwise the extension works very well, and I believe it is a lot faster to handle the low level websocket details in C, rather than in a high level PHP script.
Thank you very much.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.