Skip to content

Commit

Permalink
1 ➡️ 2
Browse files Browse the repository at this point in the history
Signed-off-by: Louise Poubel <[email protected]>
  • Loading branch information
chapulina committed Aug 7, 2020
2 parents 6d9e2ce + c4bb76a commit 8f85201
Show file tree
Hide file tree
Showing 19 changed files with 82,194 additions and 337 deletions.
19 changes: 19 additions & 0 deletions .github/ci/packages.apt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
binutils-dev
libgflags-dev
libignition-cmake2-dev
libignition-common3-dev
libignition-fuel-tools4-dev
libignition-gazebo3-dev
libignition-gui3-dev
libignition-math6-dev
libignition-math6-eigen3-dev
libignition-msgs5-dev
libignition-physics2-dev
libignition-plugin-dev
libignition-sensors3-dev
libignition-tools-dev
libignition-transport8-dev
libsdformat9-dev
libtinyxml2-dev
libwebsockets-dev
libyaml-dev
36 changes: 0 additions & 36 deletions .github/workflows/ci-bionic.yml

This file was deleted.

27 changes: 27 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Ubuntu CI

on: [push]

jobs:
bionic-ci:
runs-on: ubuntu-latest
name: Ubuntu Bionic CI
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Compile and test
id: ci
uses: ignition-tooling/action-ignition-ci@master
with:
codecov-token: ${{ secrets.CODECOV_TOKEN }}
focal-ci:
runs-on: ubuntu-latest
name: Ubuntu Focal CI
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Compile and test
id: ci
uses: ignition-tooling/action-ignition-ci@focal
with:
codecov-token: ${{ secrets.CODECOV_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ build-*

# OS generated files
.DS_Store
*.bak
*.swp
*.swo
*.orig
Expand Down
27 changes: 27 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,33 @@

## Ignition Launch 1.x

### Ignition Launch 1.8.0 (2020-07-28)

1. Added `<max_connections>` to the websocket server that supports
specifying the maximum allowed websocket connections.
* [Pull Request 40](https://github.com/ignitionrobotics/ign-launch/pull/40)

### Ignition Launch 1.7.1 (2020-06-23)

1. Improve websocket performance by throttling the busy loop, and fix empty SSL
XML elements.
* [Pull Request 37](https://github.com/ignitionrobotics/ign-launch/pull/37)

### Ignition Launch 1.7.0 (2020-06-16)

1. Added SSL to websocket server.
* [Pull Request 34](https://github.com/ignitionrobotics/ign-launch/pull/34)

### Ignition Launch 1.6.0 (2020-06-11)

1. Improved websockets by: adding simple authentication, access to
protobuf message definitions, access to scene and world information, and
definition of custom message framing.
* [Pull Request 22](https://github.com/ignitionrobotics/ign-launch/pull/22)
* [Pull Request 21](https://github.com/ignitionrobotics/ign-launch/pull/21)
* [Pull Request 17](https://github.com/ignitionrobotics/ign-launch/pull/17)
* [Pull Request 33](https://github.com/ignitionrobotics/ign-launch/pull/33)

### Ignition Launch 1.5.0 (2020-05-20)

1. Added support for spawning multiple entities in the same simulation step.
Expand Down
18 changes: 18 additions & 0 deletions examples/websocket.ign
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,24 @@
topic -->
<plugin name="ignition::launch::WebsocketServer"
filename="libignition-launch-websocket-server.so">
<publication_hz>30</publication_hz>
<port>9002</port>
<authorization_key>auth_key</authorization_key>
<admin_authorization_key>admin_key</admin_authorization_key>

<!-- The maximum number of allowed connections. If this element is not
defined or negative, then a limit is not enforced. -->
<max_connections>0</max_connections>

<!-- SSL configuration -->
<!-- Specify the path to both the certificate and private key. -->
<!-- Sample self-signed SSL certifacts are located in the
`plugins/websocket_server/` directory with the names `localhost.cert`
and `localhost.key`. -->
<!--<ssl>
<cert_file>PATH_TO_CERT_FILE</cert_file>
<private_key_file>PATH_TO_KEY_FILE</private_key_file>
</ssl> -->
</plugin>

</ignition>
11 changes: 11 additions & 0 deletions plugins/websocket_server/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@ if (websockets_FOUND)
set (sources WebsocketServer.cc)

add_library(${plugin} SHARED ${sources})

file (READ combined.proto WEBSOCKETSERVER_MESSAGE_DEFINITIONS)
configure_file("MessageDefinitions.hh.in"
"${CMAKE_CURRENT_BINARY_DIR}/MessageDefinitions.hh" @ONLY)
# Add a dependency on binary source dir so that you can change the
# combinded.proto file and `make` will rebuild the plugin.
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS combined.proto)
target_include_directories(${plugin} PRIVATE
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/>
)

target_link_libraries(${plugin}
PRIVATE
${websockets_LIBRARIES}
Expand Down
33 changes: 33 additions & 0 deletions plugins/websocket_server/MessageDefinitions.hh.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Copyright (C) 2020 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef IGNITION_LAUNCH_WEBSOCKETSERVER_MESSAGEDEFINITIONS_HH_
#define IGNITION_LAUNCH_WEBSOCKETSERVER_MESSAGEDEFINITIONS_HH_

namespace ignition
{
namespace launch
{
/// \brief All of the protobuf messages provided by the websocket
/// server.
///
/// \todo Get this information from a running simulation. The problem
/// right now is that Ignition Transport does not show subscribers.
static const std::string kWebSocketServerMessageDefinitions =
R"protos(@WEBSOCKETSERVER_MESSAGE_DEFINITIONS@)protos";
}
}
#endif
46 changes: 46 additions & 0 deletions plugins/websocket_server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,49 @@ ign launch -f examples/websocket.ign -v 4
```
firefox plugins/websocket_server/index.html
```


# Authorization

The `websocket_server` plugin accepts to authentication keys:

* `<authorization_key>` : If this is set, then a connection must provide the
matching key using an "auth" call on the websocket. If the `<admin_authorization_key>` is set, then the connection can provide that key.

* `<admin_authorization_key>` : If this is set, then a connection must provide the matching key using an "auth" call on the websocket. If the `<authorization_key>` is set, then the connection can provide that key.

Two keys are used in order to support authorization of different users.
A competition scenario may require admin access while prohibiting user
access.

# SSL

1. Use the `localhost.cert` and `localhost.key` files for testing purposes.
Configure the websocket plugin using:

```
<ssl>
<cert_file>PATH_TO_localhost.cert</cert_file>
<private_key_file>PATH_TO_localhost.key</private_key_file>
</ssl>
```

* You can create your own self-signed certificates using the following
command. Use "localhost" for the "Common Name" question.

```
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout server.key -out server.cert
```

2. Run the plugin.

3. Run a browser, such as firefox, with the `index.html` file.

```
firefox index.html
```

4. Open another browser tab, and go to `https://localhost:9002`. Accept the
certificate.

5. Refresh the `index.html` browser tab.
Loading

0 comments on commit 8f85201

Please sign in to comment.