Bonjour,

Je cherche à faire fonctionner la websocket basée sur les composants Indy partagée ici : https://gitlab.com/staspiter/websock...o/tree/master/
Je suis sous Delphi XE5 dans un projet Firemonkey et j'ai des erreurs que je n'arrive pas à corriger concernant la manipulation d'un tableau de Byte.

Voici la fonction concernée :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
procedure TWebSocketIOHandlerHelper.WriteBytes(RawData: TArray<byte>);
var
  Msg: TArray<byte>;
begin
  // https://stackoverflow.com/questions/8125507/how-can-i-send-and-receive-websocket-messages-on-the-server-side
 
  Msg := [$81];
 
  if Length(RawData) <= 125 then
    Msg := Msg + [Length(RawData)]
  else if (Length(RawData) >= 126) and (Length(RawData) <= 65535) then
    Msg := Msg + [126, (Length(RawData) shr 8) and 255, Length(RawData) and 255]
  else
    Msg := Msg + [127, (int64(Length(RawData)) shr 56) and 255, (int64(Length(RawData)) shr 48) and 255,
      (int64(Length(RawData)) shr 40) and 255, (int64(Length(RawData)) shr 32) and 255,
      (Length(RawData) shr 24) and 255, (Length(RawData) shr 16) and 255, (Length(RawData) shr 8) and 255, Length(RawData) and 255];
 
  Msg := Msg + RawData;
 
  try
    Write(TIdBytes(Msg), Length(Msg));
  except
  end;
end;
J'ai les erreurs suivantes à la compilation
[dcc32 Erreur] WebSocketServer.pas(216): E2010 Types incompatibles : 'System.TArray<System.Byte>' et 'Set'
[dcc32 Erreur] WebSocketServer.pas(223): E2010 Types incompatibles : 'Integer' et 'Int64'
Dans ma version de Delphi je ne peux pas manipuler un tableau de la sorte : Msg := [$81];, ou encore : Msg := Msg + [Length(RawData)]
Mais je galère en utilisant SetLength et en écrivant les données Byte par Byte.

Pouvez-vous m'aider à traduire cette fonction ?

Merci