From 66ae1bd758d17b7e3ea031fb18f00e3accf0d659 Mon Sep 17 00:00:00 2001 From: Niklas Date: Sat, 23 Jan 2021 01:43:25 +0100 Subject: [PATCH] added simple websocket connection --- src/components/DeckButton.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/components/DeckButton.tsx b/src/components/DeckButton.tsx index c8468b5..a56e72e 100644 --- a/src/components/DeckButton.tsx +++ b/src/components/DeckButton.tsx @@ -7,18 +7,24 @@ import { View, } from 'react-native'; +const ws = new WebSocket('ws://192.168.1.109:8069/ws'); + interface Props { text: string; } export default function DeckButton(props: Props) { + function pressed() { + ws.send(props.text); + } + return ( <> console.log(props.text)} + onPress={pressed} onLongPress={() => console.log('long press')}> {props.text}