Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Origins , where is your api docs? #39

Closed
Neumann-Valle opened this issue Sep 11, 2016 · 13 comments
Closed

Origins , where is your api docs? #39

Neumann-Valle opened this issue Sep 11, 2016 · 13 comments

Comments

@Neumann-Valle
Copy link
Contributor

Hi, @walkor hope you are fine..

Can you post the link where you phpsocket.io api is located, I am trying to restrict ORIGIN to my domain, can you tell me how is this accomplished?

regards

@Neumann-Valle
Copy link
Contributor Author

anything, lol..

@walkor
Copy link
Owner

walkor commented Sep 14, 2016

$io = new SocketIO(2020);
$io->origins('http://example.com:8080');

Sorry for the delay.

@Neumann-Valle
Copy link
Contributor Author

Thanks, can an array be passed of Domains that can connect to my app?

Also, where is the api..?

@Neumann-Valle
Copy link
Contributor Author

I need to get the socket.id I was thinking maybe i could find it calling $io->sockets->connected just like in socket.io but was not property of $io..

Any help?

@walkor
Copy link
Owner

walkor commented Sep 14, 2016

Multiple origins like this.

$io = new SocketIO(2020);
$io->origins('http://domain.com:* http://domain.org:* http://domain.net:* http://domain.gov:*');

You can get socket.id just by $socket->id.

More api please see http://socket.io/docs/server-api/ .

@Neumann-Valle
Copy link
Contributor Author

I know about $socket->id i am talking about getting other sockets connected and the work with their socket,

Beside that api is for socket.io node , u mean that ur project trasnlate to same api?

@walkor
Copy link
Owner

walkor commented Sep 14, 2016

Yes , this porject is just trasnlate socket.io by workerman.
The api is almost the same as socket.io.

@Neumann-Valle
Copy link
Contributor Author

Ah, i see let play with it and see how it goes.

@Neumann-Valle
Copy link
Contributor Author

Also, will be good idea if u comment this in the readme of your project...

Would help a lot..

@walkor
Copy link
Owner

walkor commented Sep 14, 2016

Thank you for your suggestion.
I will do that.

@Neumann-Valle
Copy link
Contributor Author

Ok, I played a bit with $io->origins('http://my-domain.com:*'); and still let me connect which is not the domain I want it to be allowed...

in my other app I have in Javascript,

io = io.listen(server ,{
origins : function( origin, fn ){
                if( u.Ar_contains( options.domains , origin ) ){
                    return fn( null, true );
                }else{
                    return fn( null, false );
                }
            }
}

which restrict and allow only those domain I want to connect to my app..

Can you help me on this?,
In your example I don't see where is being tested for allowed origins....

thanks for your help

@walkor
Copy link
Owner

walkor commented Sep 14, 2016

https://github.com/walkor/phpsocket.io/blob/master/src/Engine/Engine.php#L159

Here are the codes deal with origin, May be you can debug by your self. : )

@Neumann-Valle
Copy link
Contributor Author

I don't seem to have that method::checkRequest , is that the upcoming version you are working on?

Or I don't have the current version.. how do I find out..

Yes, just find out I don't have the current, had to download current from master to have the current code..

playing around a bit now.. Origin test doesn't work...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants