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

Request response browser2 #561

Open
wants to merge 33 commits into
base: RequestResponseBrowser1
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
7d9d1c5
Interface checkpoint
Jul 17, 2024
32ac472
Update MacOS to arm64 (#558)
waahm7 Jul 17, 2024
a7b1f84
Merge branch 'RequestResponseBrowser1' into RequestResponseBrowser2
bretambrose Jul 18, 2024
d2d130b
Checkpoint
bretambrose Jul 18, 2024
b35d0cd
Merge branch 'RequestResponseBrowser1' into RequestResponseBrowser2
bretambrose Jul 18, 2024
0b479c1
Subscription manager port
bretambrose Jul 19, 2024
19bcd02
Simple logging API; defaults to console
Jul 22, 2024
0d311d6
Merge branch 'SimpleLogging' into RequestResponseBrowser2
Jul 22, 2024
1874d8e
Tweaks
Jul 22, 2024
4c063cc
Spelling
Jul 22, 2024
7200c6b
Merge branch 'SimpleLogging' into RequestResponseBrowser2
Jul 22, 2024
01bdae5
Cautionary comments
Jul 22, 2024
bbaceea
Merge branch 'SimpleLogging' into RequestResponseBrowser2
Jul 22, 2024
ce453da
Simplify API
Jul 22, 2024
6016a59
Merge branch 'SimpleLogging' into RequestResponseBrowser2
Jul 22, 2024
2800adb
Subscription Manager logging
Jul 22, 2024
4ed32c6
Checkpoint
Jul 24, 2024
e617c72
Checkpoint
bretambrose Jul 24, 2024
927420f
Checkpoint
Jul 26, 2024
880fd88
Checkpoint
bretambrose Jul 26, 2024
fbdc8ac
Test complete
bretambrose Jul 26, 2024
dd9c928
Move mock and support functions to separate file for future sharing
Jul 29, 2024
571a3c2
Use node-16 for Mac OS arm64 CI job (#566)
sfod Aug 12, 2024
9f1d1ed
Update submodules (#570)
sbSteveK Aug 15, 2024
c0f12be
Update dependencies (#571)
sbSteveK Aug 16, 2024
fb0b4ed
Prebuild aws-lc (#564)
sfod Aug 16, 2024
1de478c
Continuous Delivery nodejs version bump (#573)
sbSteveK Aug 16, 2024
d2f7e6b
Revert Dependencies (#574)
sbSteveK Aug 20, 2024
66650ca
Merge branch 'main' into RequestResponseBrowser2
bretambrose Aug 23, 2024
9e23992
Merge from main
bretambrose Aug 23, 2024
08ac514
Bump size
bretambrose Aug 23, 2024
0cd4daa
Use session token on session credentials
bretambrose Aug 26, 2024
e14deae
PR updates
bretambrose Aug 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .builder/actions/crt_size_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def run(self, env):
# Maximum package size (for current platform) in bytes
# NOTE: if you increase this, you might also need to increase the
# limit in continuous-delivery/pack.sh
max_size = 7_750_000
max_size = 8_000_000
# size of current folder
folder_size = 0
# total size in bytes
Expand Down
19 changes: 16 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- 'docs'

env:
BUILDER_VERSION: v0.9.56
BUILDER_VERSION: v0.9.62
BUILDER_SOURCE: releases
BUILDER_HOST: https://d19elf31gohf1l.cloudfront.net
PACKAGE_NAME: aws-crt-nodejs
Expand Down Expand Up @@ -129,8 +129,21 @@ jobs:
cd aws-crt-nodejs
node ./scripts/build --target-arch ia32 -DAWS_WARNINGS_ARE_ERRORS=ON

osx:
runs-on: macos-12 # latest
macos:
runs-on: macos-14 # latest
steps:
- name: Build ${{ env.PACKAGE_NAME }} + consumers
run: |
python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder')"
chmod a+x builder
./builder build -p ${{ env.PACKAGE_NAME }} --spec=downstream
- name: Check backward compatibility for Macos
run: |
cd aws-crt-nodejs
python3 codebuild/macos_compatibility_check.py arm64

macos-x64:
runs-on: macos-14-large # latest
steps:
- name: Build ${{ env.PACKAGE_NAME }} + consumers
run: |
Expand Down
16 changes: 11 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,17 @@ if (BUILD_DEPS)

add_subdirectory(crt/aws-c-common)
if (UNIX AND NOT APPLE)
set(SEARCH_LIBCRYPTO OFF)
set(DISABLE_GO ON)
set(DISABLE_PERL ON)
set(BUILD_LIBSSL OFF)
add_subdirectory(crt/aws-lc)
include(AwsPrebuildDependency)
# s2n-tls uses libcrypto during its configuration, so we need to prebuild aws-lc.
prebuild_dependency(
DEPENDENCY_NAME AWSLC
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/crt/aws-lc
CMAKE_ARGUMENTS
-DDISABLE_GO=ON
-DDISABLE_PERL=ON
-DBUILD_LIBSSL=OFF
-DBUILD_TESTING=OFF
)
set(UNSAFE_TREAT_WARNINGS_AS_ERRORS OFF)
add_subdirectory(crt/s2n)
endif()
Expand Down
8 changes: 8 additions & 0 deletions builder.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@
"al2012": {
"!packages": [],
"!imports": [ "node-14" ]
},
"macos": {
"architectures": {
"arm64": {
"_comment": "Mac OS (arm64) has only experimental support for Node v15 and earlier, so stick to Node v16, see Node v15 docs: https://github.com/nodejs/node/blob/v15.x/BUILDING.md#platform-list",
"!imports": [ "node-16" ]
}
}
}
},
"targets": {
Expand Down
2 changes: 1 addition & 1 deletion continuous-delivery/pack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ mkdir $UNZIP
tar -xf aws-crt-$CURRENT_TAG.tgz -C $UNZIP
PACK_FILE_SIZE_KB=$(du -sk $UNZIP | awk '{print $1}')
echo "Current package size: ${PACK_FILE_SIZE_KB}"
if expr $PACK_FILE_SIZE_KB \> "$((25000))" ; then
if expr $PACK_FILE_SIZE_KB \> "$((26000))" ; then
# the package size is too large, return -1
echo "Package size is too large!"
exit -1
Expand Down
2 changes: 1 addition & 1 deletion continuous-delivery/pack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: 0.2
phases:
install:
runtime-versions:
nodejs: 10
nodejs: 14
pre_build:
commands:
- cd aws-crt-nodejs
Expand Down
2 changes: 1 addition & 1 deletion continuous-delivery/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: 0.2
phases:
install:
runtime-versions:
nodejs: 10
nodejs: 14
build:
commands:
- cd aws-crt-nodejs
Expand Down
2 changes: 1 addition & 1 deletion continuous-delivery/test-version-exists.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: 0.2
phases:
install:
runtime-versions:
nodejs: 10
nodejs: 14
build:
commands:
- cd aws-crt-nodejs
Expand Down
2 changes: 1 addition & 1 deletion crt/aws-c-auth
Submodule aws-c-auth updated 201 files
2 changes: 1 addition & 1 deletion crt/aws-c-common
Submodule aws-c-common updated 116 files
2 changes: 1 addition & 1 deletion crt/aws-lc
2 changes: 1 addition & 1 deletion crt/s2n
Submodule s2n updated from 171c96 to 114cca
10 changes: 8 additions & 2 deletions lib/browser/io.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@
* @mergeTarget
*/

export { TlsVersion, SocketType, SocketDomain } from "../common/io";
import { SocketType, SocketDomain } from "../common/io";
import { setLogLevel, LogLevel, SocketType, SocketDomain } from "../common/io";
// Do not re-export the logging functions in common; they are package-private
export { setLogLevel, LogLevel, TlsVersion, SocketType, SocketDomain } from "../common/io";


/**
* @return false, as ALPN is not configurable from the browser
Expand Down Expand Up @@ -112,3 +114,7 @@ export class SocketOptions {
public keep_alive_max_failed_probes = 0) {
}
}

export function enable_logging(level: LogLevel) {
setLogLevel(level);
}
30 changes: 18 additions & 12 deletions lib/browser/mqtt_request_response/protocol_adapter.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,22 @@ interface TestingOptions {
builder_mutator311?: (builder: aws_iot_mqtt311.AwsIotMqttConnectionConfigBuilder) => aws_iot_mqtt311.AwsIotMqttConnectionConfigBuilder,
}

function build_protocol_client_mqtt5(builder_mutator?: (builder: aws_iot_mqtt5.AwsIotMqtt5ClientConfigBuilder) => aws_iot_mqtt5.AwsIotMqtt5ClientConfigBuilder) : mqtt5.Mqtt5Client {
let provider: auth.StaticCredentialProvider = new auth.StaticCredentialProvider({
function getTestingCredentials() : auth.AWSCredentials {
let credentials : auth.AWSCredentials = {
aws_access_id: test_utils.ClientEnvironmentalConfig.AWS_IOT_ACCESS_KEY_ID,
aws_secret_key: test_utils.ClientEnvironmentalConfig.AWS_IOT_SECRET_ACCESS_KEY,
aws_region: "us-east-1"
});
};

if (test_utils.ClientEnvironmentalConfig.AWS_IOT_SESSION_TOKEN !== "") {
credentials.aws_sts_token = test_utils.ClientEnvironmentalConfig.AWS_IOT_SESSION_TOKEN;
}

return credentials;
}

function build_protocol_client_mqtt5(builder_mutator?: (builder: aws_iot_mqtt5.AwsIotMqtt5ClientConfigBuilder) => aws_iot_mqtt5.AwsIotMqtt5ClientConfigBuilder) : mqtt5.Mqtt5Client {
let provider: auth.StaticCredentialProvider = new auth.StaticCredentialProvider(getTestingCredentials());

let builder = aws_iot_mqtt5.AwsIotMqtt5ClientConfigBuilder.newWebsocketMqttBuilderWithSigv4Auth(
test_utils.ClientEnvironmentalConfig.AWS_IOT_HOST,
Expand All @@ -56,11 +66,7 @@ function build_protocol_client_mqtt5(builder_mutator?: (builder: aws_iot_mqtt5.A
}

function build_protocol_client_mqtt311(builder_mutator?: (builder: aws_iot_mqtt311.AwsIotMqttConnectionConfigBuilder) => aws_iot_mqtt311.AwsIotMqttConnectionConfigBuilder) : mqtt311.MqttClientConnection {
let provider: auth.StaticCredentialProvider = new auth.StaticCredentialProvider({
aws_access_id: test_utils.ClientEnvironmentalConfig.AWS_IOT_ACCESS_KEY_ID,
aws_secret_key: test_utils.ClientEnvironmentalConfig.AWS_IOT_SECRET_ACCESS_KEY,
aws_region: "us-east-1"
});
let provider: auth.StaticCredentialProvider = new auth.StaticCredentialProvider(getTestingCredentials());

let builder = aws_iot_mqtt311.AwsIotMqttConnectionConfigBuilder.new_builder_for_websocket();
builder.with_credential_provider(provider);
Expand Down Expand Up @@ -353,11 +359,11 @@ async function do_get_connection_state_test(version: ProtocolVersion) {
version: version
});

expect(context.adapter.getConnectionState()).toEqual(protocol_adapter.ConnectionState.DISCONNECTED);
expect(context.adapter.getConnectionState()).toEqual(protocol_adapter.ConnectionState.Disconnected);

await context.open();

expect(context.adapter.getConnectionState()).toEqual(protocol_adapter.ConnectionState.CONNECTED);
expect(context.adapter.getConnectionState()).toEqual(protocol_adapter.ConnectionState.Connected);

await context.close();
}
Expand All @@ -380,15 +386,15 @@ async function do_connection_event_test(version: ProtocolVersion) {
await context.open();

let connection_event1 : protocol_adapter.ConnectionStatusEvent = (await event1_promise)[0];
expect(connection_event1.status).toEqual(protocol_adapter.ConnectionState.CONNECTED);
expect(connection_event1.status).toEqual(protocol_adapter.ConnectionState.Connected);
expect(connection_event1.joinedSession).toEqual(false);

let event2_promise = once(context.adapter, protocol_adapter.ProtocolClientAdapter.CONNECTION_STATUS);

await context.stopProtocolClient();

let connection_event2 : protocol_adapter.ConnectionStatusEvent = (await event2_promise)[0];
expect(connection_event2.status).toEqual(protocol_adapter.ConnectionState.DISCONNECTED);
expect(connection_event2.status).toEqual(protocol_adapter.ConnectionState.Disconnected);
}

test_utils.conditional_test(test_utils.ClientEnvironmentalConfig.hasIoTCoreEnvironmentCred())('Protocol Adapter Connection Event Sequence - Mqtt5', async () => {
Expand Down
Loading
Loading