Skip to content
This repository has been archived by the owner on Oct 23, 2019. It is now read-only.

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
tabuna committed Oct 17, 2017
1 parent 592af6e commit 88f95c0
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 20 deletions.
22 changes: 22 additions & 0 deletions src/BaseSocketListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,33 @@

abstract class BaseSocketListener implements MessageComponentInterface
{
/**
* @param ConnectionInterface $conn
*
* @return mixed
*/
abstract public function onOpen(ConnectionInterface $conn);

/**
* @param ConnectionInterface $from
* @param string $msg
*
* @return mixed
*/
abstract public function onMessage(ConnectionInterface $from, $msg);

/**
* @param ConnectionInterface $conn
*
* @return mixed
*/
abstract public function onClose(ConnectionInterface $conn);

/**
* @param ConnectionInterface $conn
* @param \Exception $e
*
* @return mixed
*/
abstract public function onError(ConnectionInterface $conn, \Exception $e);
}
6 changes: 3 additions & 3 deletions src/Config/socket.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
* $httpHost HTTP hostname clients intend to connect to.
* MUST match JS `new WebSocket('ws://$httpHost')`.
*/
'httpHost' => env('SOCKET_HTTP_HOST', 'localhost'),
'httpHost' => env('SOCKET_HTTP_HOST', 'localhost'),

/*
* Port to listen on. If 80, assuming production,
* Flash on 843 otherwise expecting Flash to be proxied through 8843
*/
'port' => env('SOCKET_PORT', '8080'),
'port' => env('SOCKET_PORT', '8080'),

/*
* Public port for Nginx
Expand All @@ -23,5 +23,5 @@
* IP address to bind to. Default is localhost/proxy only.
* `0.0.0.0` for any machine.
*/
'address' => env('SOCKET_ADDRESS', '127.0.0.1'),
'address' => env('SOCKET_ADDRESS', '127.0.0.1'),
];
4 changes: 2 additions & 2 deletions src/Console/MakeListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class MakeListener extends GeneratorCommand
*/
protected function getStub()
{
return __DIR__.'/stubs/listener.stub';
return __DIR__ . '/stubs/listener.stub';
}

/**
Expand All @@ -46,6 +46,6 @@ protected function getStub()
*/
protected function getDefaultNamespace($rootNamespace)
{
return $rootNamespace.'\Http\Sockets';
return $rootNamespace . '\Http\Sockets';
}
}
2 changes: 1 addition & 1 deletion src/Console/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function handle()
{
$socket = new Socket($this->httpHost, $this->port, $this->address);
require base_path('routes/socket.php');
$this->info('Laravel web socket server started on '.$this->httpHost.':'.$this->port.'/'.'address:'.$this->address);
$this->info('Laravel web socket server started on ' . $this->httpHost . ':' . $this->port . '/' . 'address:' . $this->address);
$socket->run();
}
}
4 changes: 2 additions & 2 deletions src/Providers/ConsoleServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class ConsoleServiceProvider extends ServiceProvider
public function register()
{
foreach ($this->commands as $command) {
$this->commands($this->namespace.$command);
$this->commands($this->namespace . $command);
}
}

Expand All @@ -48,7 +48,7 @@ public function provides()
$provides = [];

foreach ($this->commands as $command) {
$provides[] = $this->namespace.$command;
$provides[] = $this->namespace . $command;
}

return $provides;
Expand Down
15 changes: 3 additions & 12 deletions src/Providers/SocketServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ public function boot()
protected function registerConfig()
{
$this->publishes([
__DIR__.'/../Config/socket.php' => config_path('socket.php'),
__DIR__.'/../socket.php' => base_path('routes/socket.php'),
realpath(__DIR__ . '/../Config/socket.php') => config_path('socket.php'),
realpath(__DIR__ . '/../socket.php') => base_path('routes/socket.php'),
]);
$this->mergeConfigFrom(
__DIR__.'/../Config/socket.php', 'socket'
realpath(__DIR__ . '/../Config/socket.php'), 'socket'
);
}

Expand All @@ -45,15 +45,6 @@ public function registerProviders()
$this->app->register('Orchid\\Socket\\Providers\\ConsoleServiceProvider');
}

/**
* Register the service provider.
*
* @return void
*/
public function register()
{
}

/**
* Get the services provided by the provider.
*
Expand Down

0 comments on commit 88f95c0

Please sign in to comment.