braverhealth / phoenix-socket-dart

Cross-platform and stream-based implementation of Phoenix Sockets
https://pub.dev/packages/phoenix_socket
BSD 3-Clause "New" or "Revised" License
73 stars 37 forks source link

Add support for custom decoder and encoder #63

Closed rsmything closed 6 months ago

rsmything commented 1 year ago

Parent: https://github.com/braverhealth/phoenix-socket-dart/pull/59

Adding support to add your own encoder and decoder.

For example:

Using BERT decoder for incoming messages https://pub.dev/packages/bert https://github.com/Youimmi/bert.git

import 'package:bert/bert.dart as bert';
import 'package:phoenix_socket/src/message_serializer.dart';

socket = PhoenixRawSocket(
  socketUrl,
  socketOptions: PhoenixSocketOptions(
    serializer: MessageSerializer(decoder: bert.decode),
  ),
);
rsmything commented 1 year ago

@matehat please check it

tlvenn commented 7 months ago

@Pacane any chance to review and merge this ?

matehat commented 6 months ago

Thanks for your contributions @rsmything ! And sorry for the delay ..!