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

Re-import axios ! #34

Merged
merged 2 commits into from
Nov 28, 2024
Merged
Changes from all commits
Commits
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
9 changes: 7 additions & 2 deletions js-src/Websocket.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { AxiosResponse } from "axios";
import { Channel } from "./Channel";
import axios from 'axios';

export type Options = { authEndpoint: string, host: string, bearerToken: string, auth: any, debug: boolean };

@@ -28,7 +29,11 @@ export class Websocket {
private pingInterval: NodeJS.Timeout;

private connect(host: string): void {
this.options.debug && console.log(LOG_PREFIX + ' Trying to connect...');
if (!host) {
this.options.debug && console.error(LOG_PREFIX + `Cannont connect without host !`);
return;
}
this.options.debug && console.log(LOG_PREFIX + `Trying to connect to ${host}...` );

this.websocket = new WebSocket(host);

@@ -57,7 +62,7 @@ export class Websocket {
this.send(message);

this.buffer.splice(0, 1);
};
}

// Register events only once connected, or they won't be registered if connection failed/lost

4,464 changes: 2,542 additions & 1,922 deletions yarn.lock

Large diffs are not rendered by default.


Unchanged files with check annotations Beta

/** @var string $message */
$message = $this->argument('message');
return tap(json_decode(base64_decode($message), true), function ($message) {

Check failure on line 73 in src/Commands/VaporHandle.php

GitHub Actions / Larastan

Method Georgeboot\LaravelEchoApiGateway\Commands\VaporHandle::message() should return array but returns mixed.
if ($message === false) {
throw new InvalidArgumentException('Unable to unserialize message.');
}
*/
public function auth($request)
{
$channelName = $this->normalizeChannelName($request->channel_name);

Check failure on line 35 in src/Driver.php

GitHub Actions / Larastan

Parameter #1 $channel of method Georgeboot\LaravelEchoApiGateway\Driver::normalizeChannelName() expects string, mixed given.
if (empty($request->channel_name) || ($this->isGuardedChannel($request->channel_name) && ! $this->retrieveUser($request, $channelName))) {

Check failure on line 37 in src/Driver.php

GitHub Actions / Larastan

Parameter #1 $channel of method Georgeboot\LaravelEchoApiGateway\Driver::isGuardedChannel() expects string, mixed given.
throw new AccessDeniedHttpException();
}
*/
public function validAuthenticationResponse($request, $result)
{
if (! Str::startsWith($request->channel_name, 'presence')) {

Check failure on line 56 in src/Driver.php

GitHub Actions / Larastan

Parameter #1 $haystack of static method Illuminate\Support\Str::startsWith() expects string, mixed given.
return response()->json(
$this->generateSignature($request->channel_name, $request->socket_id)

Check failure on line 58 in src/Driver.php

GitHub Actions / Larastan

Parameter #1 $channel of method Georgeboot\LaravelEchoApiGateway\Driver::generateSignature() expects string, mixed given.

Check failure on line 58 in src/Driver.php

GitHub Actions / Larastan

Parameter #2 $socketId of method Georgeboot\LaravelEchoApiGateway\Driver::generateSignature() expects string, mixed given.
);
}
$channelName = $this->normalizeChannelName($request->channel_name);

Check failure on line 62 in src/Driver.php

GitHub Actions / Larastan

Parameter #1 $channel of method Georgeboot\LaravelEchoApiGateway\Driver::normalizeChannelName() expects string, mixed given.
return response()->json(
$this->generateSignaturePresence(
$request->channel_name,

Check failure on line 66 in src/Driver.php

GitHub Actions / Larastan

Parameter #1 $channel of method Georgeboot\LaravelEchoApiGateway\Driver::generateSignaturePresence() expects string, mixed given.
$request->socket_id,

Check failure on line 67 in src/Driver.php

GitHub Actions / Larastan

Parameter #2 $socketId of method Georgeboot\LaravelEchoApiGateway\Driver::generateSignaturePresence() expects string, mixed given.
$this->retrieveUser($request, $channelName)->getAuthIdentifier(),

Check failure on line 68 in src/Driver.php

GitHub Actions / Larastan

Cannot call method getAuthIdentifier() on mixed.
$result
),
);