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

Commit

Permalink
update version and change structure
Browse files Browse the repository at this point in the history
  • Loading branch information
tabuna committed May 27, 2016
1 parent 9e23d81 commit 6440b03
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 31 deletions.
8 changes: 4 additions & 4 deletions Console/MakeListener.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php namespace Orchid\Socket\Console;

use Illuminate\Console\GeneratorCommand;
use Illuminate\Console\GeneratorCommand;
use Symfony\Component\Console\Input\InputOption;

Expand Down Expand Up @@ -39,13 +40,12 @@ protected function getStub()
/**
* Get the default namespace for the class.
*
* @param string $rootNamespace
* @param string $rootNamespace
*
* @return string
*/
protected function getDefaultNamespace($rootNamespace)
{
return $rootNamespace . '\Socket\Listener';
return $rootNamespace . '\Http\Socket\Listener';
}


}
27 changes: 6 additions & 21 deletions Console/Server.php
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
<?php namespace Orchid\Socket\Console;
<?php

namespace Orchid\Socket\Console;

use Config;
use Illuminate\Console\Command;
use Ratchet\App as Socket;
use Ratchet\ConnectionInterface;
use Ratchet\Http\HttpServer;
use Ratchet\MessageComponentInterface;
use Ratchet\Server\IoServer;
use Ratchet\WebSocket\WsServer;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;

class Server extends Command
{

/**
* The console command name.
*
Expand All @@ -30,17 +22,15 @@ class Server extends Command
*/
protected $description = 'Start web socket server.';


/**
* $httpHost HTTP hostname clients intend to connect to.
* MUST match JS `new WebSocket('ws://$httpHost')
* MUST match JS `new WebSocket('ws://$httpHost').
*/
protected $httpHost;


/**
* Port to listen on. If 80, assuming production,
* Flash on 843 otherwise expecting Flash to be proxied through 8843
* Flash on 843 otherwise expecting Flash to be proxied through 8843.
*/
protected $port;

Expand All @@ -50,11 +40,8 @@ class Server extends Command
*/
protected $address;


/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
Expand All @@ -73,10 +60,8 @@ public function __construct()
public function fire()
{
$socket = new Socket($this->httpHost, $this->port, $this->address);
require_once(app_path() . '/Socket/routes.php');
require_once app_path() . '/Socket/routes.php';
$this->info('Laravel web socket server started on ' . $this->httpHost . ':' . $this->port . '/' . 'address:' . $this->address);
$socket->run();
}


}
5 changes: 3 additions & 2 deletions Providers/SocketServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,17 @@ protected function registerConfig()
{
$this->publishes([
__DIR__ . '/../Config/socket.php' => config_path('socket.php'),
__DIR__ . '/../routes.php' => app_path('/Socket/routes.php'),
__DIR__ . '/../Services/Socket/routes.php' => app_path('/Http/Socket/routes.php'),
]);
$this->mergeConfigFrom(
__DIR__ . '/../Config/socket.php', 'socket'
);
}


public function registerProviders()
{
$this->app->register('Orchid\\Socket\\Providers\\ConsoleServiceProvider');
// $this->app->register('Orchid\\Socket\\Providers\\ConsoleServiceProvider');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ php artisan make:socket MyNameClass
1. add socket route

```php
You will define most of the routes for your application in the app/Socket/routes.php file
You will define most of the routes for your application in the app/Http/Socket/routes.php file
```

1. start socket server
Expand Down
7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"web",
"websocket",
"socket",
"php"
"php",
"server"
],
"license": "MIT",
"authors": [
Expand All @@ -18,8 +19,8 @@
],
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.1.*",
"cboden/ratchet": "^0.3.3"
"laravel/framework": ">5.0",
"cboden/ratchet": "^0.3.5"
},
"autoload": {
"psr-4": {
Expand Down

0 comments on commit 6440b03

Please sign in to comment.